Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

dbc connectivity with SQL server

  Asked By: Willie    Date: Dec 02    Category: Java    Views: 649
  

I m very new to Java. I put a code just before this about jdbc connectivity with
SQL server. there i have a connection object through which i m connecting with
sql server. whenever i run that script i found the error that resultset is
closed. actually i m using two single connection for a statement and this
statement is then returning two resultset in two diffrent blocks. when i make
two connection and statements for these resultset i dont get the error.
i want to clear this can i not use a single connection to open different
statements, when one is already open, and i want to create another one. why this
is generating the error. this is same for resultsets. when a statement returns a
resultset, cannt i use the same statement, for another resultset before closing
the first resultset. or there is any other error in my approach.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Fatih Farooq     Answered On: Dec 02


You can have one connection  and use multiple statements  on it as long as u dont
close the connection. And coming to the resultsets, All execution methods in the
Statement interface implicitly close a statment's current ResultSet object  if an
open one exists. if you have to use the resultset  again use different statement
objects on it. It will work.

 
Didn't find what you were looking for? Find more on dbc connectivity with SQL server Or get search suggestion and latest updates.




Tagged: