Re: JDBC gripe list

From: Basil Bourque <basil(dot)list(at)me(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC gripe list
Date: 2011-03-30 19:51:53
Message-ID: 09BBB87C-E865-4E87-82EE-0C1F739D2BB0@me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Another gripe: "InValid" method

"IsValid" method in JDBC spec is not functional (simply throws an exception).
http://download.oracle.com/javase/6/docs/api/java/sql/Connection.html#isValid(int)

This means users have to write their own routine to test if the connection is still successfully running. Example, run a query like "SELECT 1 = 1;" where you ignore the results -- you just look to see if errors occurred.

Spec:
-----
Returns true if the connection has not been closed and is still valid. The driver shall submit a query on the connection or use some other mechanism that positively verifies the connection is still valid when this method is called.
-----

Current code in "AbstractJdbc4Connection.java" of "postgresql-jdbc-9.0-801.src":
-----
public boolean isValid(int timeout) throws SQLException
{
checkClosed();
throw org.postgresql.Driver.notImplemented(this.getClass(), "isValid(int)");
}
-----

--Basil Bourque

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2011-03-30 20:50:22 Re: SSL connection failure
Previous Message David Patricola 2011-03-30 15:27:08 SSL connection failure