Re: Query Executor Problem - Mailing list pgsql-jdbc

From Daniel Germain
Subject Re: Query Executor Problem
Date
Msg-id CBEDKGKJPKEBDJECDAGLOEFECHAA.daniel.germain@gipsynet.com
Whole thread Raw
In response to Query Executor Problem  ("Email User" <support@ebusinessoft.com>)
List pgsql-jdbc
In our case we had to make sure
to discard/close/clean the connection ourself
EVERYWHERE.
We realized that in some circonstances our application server
did not release and close properly the connection from our pool.

Usually it called connection.clearWarnings(),
connection.setAutoCommit(true);
and closes the connection whenever there was an exception.

Strange things happen when the GarbageCollector/Finalizer runs
and tries to call the method org.postgresql.Connection.finalize()
which calls org.postgresql.Connection.close which execute pg_stream=null;
And it is this variable pg_stream which is null in the QueryExecutor at
line 61. The finalizer seems to disrupt internal stuff that it should not
have (database socket?), anyway you should not rely on the finalize method.

From what I remember is that we make sure WE close the connection and
not the gargage collector.
The Connection.close instruction should be the last instruction you execute
on a connection.

Good luck.

Daniel

> -----Original Message-----
> From: Email User [mailto:support@ebusinessoft.com]
> Sent: November 6, 2002 1:35 AM
> To: daniel.germain@gipsynet.com
> Cc: pgsql-jdbc@postgresql.org
> Subject: Query Executor Problem
>
>
> Hi,
> Our web based application which is using postgresql version 7.1.3  is
> showing an error as follows.
>
>  java.lang.NullPointerException
>         at
> org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:61)
>         at org.postgresql.Connection.ExecSQL(Connection.java:398)
>         at org.postgresql.jdbc2.Statement.execute(Statement.java:130
>         at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54)
>         at
> com.ebusinessoft.gen.db.DatabaseUtilities.getQueryResults(Database
> Utilities.java:71)
>         at com.ebusinessoft.ifos.rsmt.gentrip.doGet(gentrip.java:124)
>         at com.ebusinessoft.ifos.rsmt.gentrip.doPost(gentrip.java:448)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>         at org.apache.tomcat.core.Handler.service(Handler.java:286)
>         at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>         at
> org.apache.tomcat.core.ContextManager.internalService(ContextManag
> er.java:797)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>         at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.process
> Connection(Ajp12ConnectionHandler.java:166)
>         at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>         at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>         at java.lang.Thread.run(Thread.java:484)
>
>
> This type of message occurs at random and we could not assess the
> reason for
> this. We greatly  appreciate your help on this.
>
> Thanks
> Support
> support@ebusinessoft.com
>


pgsql-jdbc by date:

Previous
From: Vincent Stoessel
Date:
Subject: setboolean
Next
From: "lxj"
Date:
Subject: Hi!