Oracle connection not closing in Java Application -
i have connection leak in older java web applications not utilize connection pooling. trying find leak hard because not grant me access v$session select count(*) v$session;
so instead trying debug system.out statements. after closing connection conn.close();
when print conn system log file gives me connection object name.
try { connection conn; conn.close() } catch (sqlexception e) { } { if (conn != null) { try { system.out.println("closing connection"); conn.close(); } catch (exception ex) { system.out.println("exception " + ex); } } } // check conn , not null , can print object name. if (conn != null) { system.out.println("connection still open , " + conn); }
however if add conn = null;
below conn.close();
statement connection seems closed. question conn.close(); release connection or have make null release connection. said hard me determine if connection released without being able query v$session. there snippet of java code can give me open connections??
it's educational @ point because plan refactor these applications use connection pooling i'm looking quick bandaid now.
the important part of close what's happening on database side. it's rdbms has close connection. calling close() method communicates message database close connection.
setting connection null doesn't instruct rdbms anything.
same logic applies resultset, cursor on database side, , statement. need close in individual try/catch blocks in block of method created them, in reverse order of creation. otherwise you'll see errors "max cursors exceeded".
Comments
Post a Comment