Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Sybase JDBC driver problem

Reply
Thread Tools

Sybase JDBC driver problem

 
 
rkm
Guest
Posts: n/a
 
      01-03-2004
When I'm done using my connection to a Sybase database, I
call the conn.close() method, but it doesn't seem to clean
up the underlying physical connection. Eventually I use up
all the available connections and (assuming I don't kill my
program) the Sybase admin ends up having to close the db on
his side and reopening it.

Aside from keeping one connection open and using it forever
(my current solution which I don't like), what's the
solution to the problem of the resources not being cleaned
up? Do I need to call a finalizer method (I'm led to
believe that's a general no-no), or maybe invoke the garbage
collector? Is this a known bug in the jconn2 driver?

Rick

 
Reply With Quote
 
 
 
 
Lee Yeow Leong
Guest
Posts: n/a
 
      01-04-2004
Make sure you close your rs and statement as well.

rs.close();
stmt.close();
conn.close();

rkm wrote:
> When I'm done using my connection to a Sybase database, I call the
> conn.close() method, but it doesn't seem to clean up the underlying
> physical connection. Eventually I use up all the available connections
> and (assuming I don't kill my program) the Sybase admin ends up having
> to close the db on his side and reopening it.
>
> Aside from keeping one connection open and using it forever (my current
> solution which I don't like), what's the solution to the problem of the
> resources not being cleaned up? Do I need to call a finalizer method
> (I'm led to believe that's a general no-no), or maybe invoke the garbage
> collector? Is this a known bug in the jconn2 driver?
>
> Rick
>


 
Reply With Quote
 
 
 
 
Ike
Guest
Posts: n/a
 
      01-04-2004
Are you cleaning up everything else prior to cleaning up the connection?
Something along the lines of:
public void finalize(){
// it is a good idea to release
// resources in a finally{} block
// in reverse-order of their creation
// if they are no-longer needed
try {
if ( rs != null ) { //first the resultset object
rs.close();
}
}catch( Exception ignored ) {}
try {
if ( statement != null ) { //then the statement
statement.close();
}
}catch( Exception ignored ) {}
try {
if ( conn != null ) { then the connection
conn.close();
}
} catch( Exception ignored ) {}
rs=null;
statement=null;
conn=null;
}

//Ike

"rkm" <> wrote in message
news:...
> When I'm done using my connection to a Sybase database, I
> call the conn.close() method, but it doesn't seem to clean
> up the underlying physical connection. Eventually I use up
> all the available connections and (assuming I don't kill my
> program) the Sybase admin ends up having to close the db on
> his side and reopening it.
>
> Aside from keeping one connection open and using it forever
> (my current solution which I don't like), what's the
> solution to the problem of the resources not being cleaned
> up? Do I need to call a finalizer method (I'm led to
> believe that's a general no-no), or maybe invoke the garbage
> collector? Is this a known bug in the jconn2 driver?
>
> Rick
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [JDBC] JDBC Driver and timezones Lew Java 0 05-19-2010 03:33 PM
jdbc driver for sybase... Bumsys@gmail.com Java 3 05-17-2008 01:58 AM
How to parse the jdbc driver name from the jdbc .jar file Bruce Java 4 03-25-2006 12:01 PM
JDBC BigDecimal Problem. Castor - WebLogic - Sybase davo_java Java 1 06-23-2005 06:33 PM
oracle.jdbc.OracleDriver vs oracle.jdbc.driver.OracleDriver Betty Java 1 05-21-2005 05:15 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57