On Sep 27, 6:29 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
> tes...@hotmail.com wrote:
> > Is it okay to create 3 different ResultSets with the same Statement
[quoted text clipped - 6 lines]
>
> Arne
You mean like this?
try {
results1 = statement.executeQuery("select name from
tableone");
if(results1.next())
{
int myvar = ....
}
....
finally {
//close results1 object only here
try {
results2 = statement.executeQuery("select name from
tableone");
if(results2.next())
{
int myvar = ....
}
....
finally {
//close results2 object only here
try {
results3 = statement.executeQuery("select name from
tableone");
if(results3.next())
{
int myvar = ....
}
....
finally {
//close results3 object only here
...
//Finally block here that closes results3,
statement and connection object references
Arne Vajhøj - 29 Sep 2007 01:41 GMT
>> tes...@hotmail.com wrote:
>>> Is it okay to create 3 different ResultSets with the same Statement
[quoted text clipped - 3 lines]
>> It is OK, but I think you should close the previous result set before
>> opening a new one.
> You mean like this?
>
[quoted text clipped - 35 lines]
> //Finally block here that closes results3,
> statement and connection object references
That is one way.
Except that you should not close result in the fourth
finally if you do so in the third.
Arne