zhuzhengyu
Technical User
JDBC have 3 objects:
Connection,Statement,ResultSet
Several qustions:
1)if Statement is closed,the ResultSet produced by the Statement will close automatically?
also if the Connection is closed,the related Statements and ResultSets will close automatically?
2)if several Statements share a Connection whether problems will occurs while multi-users do query at the same time?
and if several ResultSets could share a statement?
eg:
Connection con=DriverManager.getConnection(URL,user,pass);
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from table_a"
ResultSet rs1=st.executeQuery("select * from table_b"
st.executeUpdate("delete from table_c"
if could,on which condition?
if couldn't ,what's th result?
Hope for advice
Connection,Statement,ResultSet
Several qustions:
1)if Statement is closed,the ResultSet produced by the Statement will close automatically?
also if the Connection is closed,the related Statements and ResultSets will close automatically?
2)if several Statements share a Connection whether problems will occurs while multi-users do query at the same time?
and if several ResultSets could share a statement?
eg:
Connection con=DriverManager.getConnection(URL,user,pass);
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from table_a"
ResultSet rs1=st.executeQuery("select * from table_b"
st.executeUpdate("delete from table_c"
if could,on which condition?
if couldn't ,what's th result?
Hope for advice