T
teser3
Is it okay to create 3 different ResultSets with the same Statement
object? Here is what I am currently using in my Database statements
with Oracle and everything works great. But I am wondering if this
will create Database resource leakages or other issues:
Code:
//Db connection called from another Java class
......
ResultSet results1 = null;
ResultSet results2 = null;
ResultSet results3 = null;
Statement statement = null;
.......
statement = connection.createStatement();
results1 = statement.executeQuery("select name from
tableone");
if(results1.next())
{
int myvar = ....
}
results2 = statement.executeQuery("select food, sugar from
tabletwo");
if(results2.next())
{
int myvar2 = ....
}
results3 = statement.executeQuery("select rock from
tablethree");
if(results3.next())
{
int myvar3 = ....
}
...
//Finally block here that closes results1, results2, results3,
statement and connection object references
object? Here is what I am currently using in my Database statements
with Oracle and everything works great. But I am wondering if this
will create Database resource leakages or other issues:
Code:
//Db connection called from another Java class
......
ResultSet results1 = null;
ResultSet results2 = null;
ResultSet results3 = null;
Statement statement = null;
.......
statement = connection.createStatement();
results1 = statement.executeQuery("select name from
tableone");
if(results1.next())
{
int myvar = ....
}
results2 = statement.executeQuery("select food, sugar from
tabletwo");
if(results2.next())
{
int myvar2 = ....
}
results3 = statement.executeQuery("select rock from
tablethree");
if(results3.next())
{
int myvar3 = ....
}
...
//Finally block here that closes results1, results2, results3,
statement and connection object references