Monday, November 19, 2012

java.sql.SQLException: This Connection is closed.

Hi,

i'm using GAE with Google Cloud SQL and i am creating a new db connection for each HTTP Request.  Sometimes, I receive an SQLException with "This connection is closed" even though the connection is newly created.  Here are my logs :

D 2012-11-19 15:03:02.864
ca.satisfa.db.DbManager initConnection: Initializing DB connection to jdbc:google:rdbms://....
I 2012-11-19 15:03:02.864
ca.satisfa.db.DbManager getConnection: Existing DB connection is active. Using it.
W 2012-11-19 15:03:02.870
ca.satisfa.db.DbManager validateToken: A problem happended while executing method validateToken java.sql.SQLException: This Connection is closed.

The connection is closed 6 ms after being created.  I am testing each connection with the following :

if (connection == null || connection.isClosed() || !isValid(connection)) {

where isValid(connection) do a SELECT 1.

Any idea ? Is there any known issues with Google Cloud SQL connections ? 

Thanks

No comments:

Post a Comment