[jboss-user] JDBC Connection close every 15 ...:( plz

Fairoz Sharif feroz_ps at yahoo.com
Sat Jun 13 02:57:16 EDT 2009


i dont know but i feel ur code have some problem , because freeconnection method ur invoking or not i am not sure.
try something like this everywhere ur hitting database

DBConnectionManager manager = .......
Connection conn = manager.getConnection();
try{
<!---
              your jdbc code goes here

-->
}catch(.....){

}
finally{
            try{

            }catch(....){
                conn.close();
            }

}

 

if not closed here i dont think it will closed anyway

Regards 
Fairoz Sharif 
9945066287 



May God Bless this Planet , 
Spread Peace And Love every where 
Thank You .




________________________________
From: Karthik Nanjangude <karthik.nanjangude at xius-bcgi.com>
To: "jboss-user at lists.jboss.org" <jboss-user at lists.jboss.org>
Sent: Friday, 12 June, 2009 3:55:09 PM
Subject: [jboss-user] JDBC Connection close every 15  ...:( plz

 
Hi
 
 
We are facing Connection used up every 15 minutes on  
We suspect the jboss server is not releasing the JDBC
connection 
on using the close()  method
 
JBOSS 4.2.1 or  4.2.3
JDK1.5.x
O/s Linux Redhat
Jdbc jar : ojdbc14.jar
 
 
Or am I missing any thing ?
Please some body help  me 
 
The code is as shown below
 
//Oracle-ds.xml
<local-tx-datasource>
<jndi-name>jdbc/OrclVOISE5000</jndi-name>
<connection-url>jdbc:oracle:thin:@172.16.18.22:1521:GTS22</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>tt_VOISE50</user-name>
<password>tt_VOISE50</password>
<min-pool-size>20</min-pool-size>
<max-pool-size>80</max-pool-size>
<blocking-timeout-millis>500</blocking-timeout-millis>
<idle-timeout-minutes>1</idle-timeout-minutes>
<track-statements>false</track-statements>
<metadata>
<type-mapping>Oracle10g</type-mapping>
</metadata>
</local-tx-datasource>
 
 
// global Declared Variables
DataSource ODS = null;
WrappedConnection WCP = null;
 
//Singleton
Pattern
public
static synchronized public DBConnectionManager getInstance() throws Exception {
 
if (instance == null) {
    
instance = new DBConnectionManager();
 
}
  
return instance;
}
 
 
//Constructer         
private
DBConnectionManager() throws Exception {
 String DSNAME =
InfinetUtility.getProperty("DSNAME").trim();
 System.out.println("DATASOURCE
JNDI NAME :===>|"+DSNAME+"|<=====");
 InitialContext ic
= null;
 try {
    ic =
new InitialContext();
   ODS =
(javax.sql.DataSource) ic.lookup(DSNAME);
 } catch
(NamingException e) { e.printStackTrace();}       
}
 
 
//fetch connection
public synchronized Connection getConnection(){
  Connection conn = null;
  Connection underlyingConn = null;
  OracleConnection connection= null;
  try {
    conn = ODS.getConnection();
    WCP = (WrappedConnection)conn;
    underlyingConn =
WCP.getUnderlyingConnection();
    conn = 
(OracleConnection)underlyingConn;
  } catch (SQLException sqlex) {
    
System.out.println("<<<<<<<<<<< NO
CONNECTION>>>>>>>>>>>>" +
sqlex.getMessage()
    
   }                           
  return conn;
}
 
 
//Connection close
public void freeConnection(Connection con)  {
    System.out.println("RELEASING THE
USED CONNECTION TO POOL");
    try {
      con.close();
    }catch (Exception e) {
       
e,printStackTrace();
    }          
}


      Own a website.Get an unlimited package.Pay next to nothing.*Go to http://in.business.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20090613/6e0f14d5/attachment.html 


More information about the jboss-user mailing list