The Artima Developer Community
Sponsored Link

Java Answers Forum
java.sql.SQLException: Connection is closed.0

1 reply on 1 page. Most recent reply: Jun 19, 2006 4:38 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
JayaramiReddy Nussam

Posts: 1
Nickname: nussam
Registered: Jun, 2006

java.sql.SQLException: Connection is closed.0 Posted: Jun 17, 2006 10:27 PM
Reply to this message Reply
Advertisement
Hi,
I am getting the "java.sql.SQLException: Connection is closed" now and then in my production system .i am using apache DBCP connection pooling to get the connection.
The DBCP connection pooling settings in my code are as follows......

connectionPool = new GenericObjectPool(null);
connectionPool.setMaxActive(-1);
connectionPool.setMin Idle(3);
connectionPool.setMaxIdle(Integer.parseInt(maxIdle));
connectionPool.se tTestOnBorrow(true);
connectionPool.setMaxWait(3 * 60 * 1000);
String validationQuery = "select * from tab where rownum < 5";
ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, userName, pwd);
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, validationQuery, false, true);
Class.forName("org.apache.commons.dbcp.PoolingDriver");
PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");
driver.registerPool("ecoi t", connectionPool);
.....
and when create statement is called, sql exception will be thrown with the message Connection is Closed

Exception message is as follows..

java.sql.SQLException: Connection is closed.0: org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.jav a:274)1: org.apache.commons.dbcp.DelegatingConnection.createStatement(DelegatingConnecti on.java:199)2:
...........
................
I am unable to find the ROOT CAUSE of this issue since it is not reproduceble in Development environment...Could you please help me to figure out the ROOT CAUSE and when it happens.

Thanks in advance..
-Jayaram.


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: java.sql.SQLException: Connection is closed.0 Posted: Jun 19, 2006 4:38 AM
Reply to this message Reply
It's not so easy to get the route cause with such little info. Besides that I don't know Appache very well.

Do it old-style:
Create an output after each important line to see if the connection is still open.

Maybe you just have to open the connection manually on the target system (different driver settings).

Flat View: This topic has 1 reply on 1 page
Topic: Type mismatch error. Previous Topic   Next Topic Topic: interchange 3d Data

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use