Re: PoolingDataSource: java.sql.SQLException: Connection is closed

Поиск
Список
Период
Сортировка
От Sean Owen
Тема Re: PoolingDataSource: java.sql.SQLException: Connection is closed
Дата
Msg-id AANLkTikxEgKEXPEYTc6z9XuZwuQd-i5o8jg6RX+OB__x@mail.gmail.com
обсуждение исходный текст
Ответ на PoolingDataSource: java.sql.SQLException: Connection is closed  (Michael musset <mickamusset@gmail.com>)
Список pgsql-jdbc
The pool is not being able to check whether a connection is still usable before using it.

I've never used PostgreSQL myself, but, for MySQL, I've always specified a query that can be used to test the connection in a pool to see if it's alive. You might try:

      validationQuery="SELECT 1"

You can try that.

Incidentally I put in an 'experimental' alternative implementation of the DataSource for PostgreSQL. I'd be interested to know if you are using it and if it works. It has to do a few things differently than the MySQL version which uses some MySQL-specific shortcuts as optimizations.

On Thu, Nov 18, 2010 at 5:10 PM, Michael musset <mickamusset@gmail.com> wrote:
Hi,

On my Ubuntu 10.04 Server, I have Tomcat6 running + Postgresql 9.

I use the javax.sql.DataSource like that on my context.xml  file :

<Context>
 <Resource name="jdbc/**********"
   auth="Container"
   type="javax.sql.DataSource"
   maxActive="100"
   maxIdle="30"
   maxWait="20000"
   removeAbandoned="true"
   removeAbandonedTimeout="1120"
   username="**********"
   password="******"
   logAbandoned="true"
   driverClassName="org.postgresql.Driver"
   url="jdbc:postgresql://localhost/DB?autoReconnect=true"
 />
</Context>


do you have an idea why I got this error ? :

java.sql.SQLException: Connection is closed.
       at
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.checkOpen(PoolingDataSource.java:185)
       at
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:317)


When i'm trying to do get a Preparestatement or sometimes on the execute()
command.


My idea is there is too much connection not closed correctly, but i'm sure
that i closed every connection that I open.
And in my context configuration I use :
   removeAbandoned="true"
   removeAbandonedTimeout="1120"

and jdbc:postgresql://localhost/DB?*autoReconnect=true*

Thanks in advance for the help.




--
Michael Musset,
Tel: 06 26 06 29 89

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Michael musset
Дата:
Сообщение: PoolingDataSource: java.sql.SQLException: Connection is closed
Следующее
От: Thomas Markus
Дата:
Сообщение: Re: JDBC : this statement has been closed : postgresql 9