Organizational Research By

Surprising Reserch Topic

reusing resultset

reusing resultset  using -'java,sql,jdbc,resultset'

I need to run several queries in a row

Statement st = cnx.createStatement();
ResultSet rs = st.executeQuery( "SELECT [good stuff]");
// do something smart with rs
rs = st.execute( "SELECT [better stuff]");
// do something smarter with rs
rs = st.execute( "SELECT [best stuff]");
// you got it
try{ rs.close();} catch( SQLException ignore){};
try{ st.close();} catch( SQLException ignore){};

Is this a problem that the first two ResultSet are not properly closed or is it implicitely done during garbage collection?

asked Oct 19, 2015 by tejas lakhani
0 votes

Related Hot Questions

Government Jobs Opening