Is it okay to keep creating queries with the same ResultSet Object reference (results)? Here is what I am currently using in my Database statements with Oracle and everything works but was wondering if this is okay where I am using ResultSet results for 3 queries in my Tomcat container:
Code:
ResultSet results = null; Statement statement = null; ...... statement = connection.createStatement(); results = statement.executeQuery("select name from tableone"); if(results.next()) { int myvar = .... } results = statement.executeQuery("select food, sugar from tabletwo"); if(results.next()) { int myvar2 = .... } results = statement.executeQuery("select rock from tablethree"); if(results.next()) { int myvar3 = .... } ... //close results, statement and connection object references
Comment