dev@glassfish.java.net

Re: Glassfish, JDK6 and JDBC4

From: Binod <Binod.Pg_at_Sun.COM>
Date: Thu, 14 Dec 2006 16:47:35 +0530

After teading the javadoc, postgress driver seem to be throwing the
SQLException incorrectly.

"


          getClientInfo

Properties <http://java.sun.com/javase/6/docs/api/java/util/Properties.html> *getClientInfo*()
                         throws SQLException <http://java.sun.com/javase/6/docs/api/java/sql/SQLException.html>

    Returns a list containing the name and current value of each client
    info property supported by the driver. The value of a client info
    property may be null if the property has not been set and does not
    have a default value.

    *Returns:*
        A |Properties| object that contains the name and current value
        of each of the client info properties supported by the driver.

    *Throws:*
        |SQLException
        <http://java.sun.com/javase/6/docs/api/java/sql/SQLException.html>|
        - if the database server returns an error when fetching the
        client info values from the database or this method is called on
        a closed connection

"

Postgress driver should have returned null, if they are not implementing
the method. Throwing SQLException seem to be a bad choice.
Appserver wont be able to distinguish between a database error (in which
case, exception should be logged) and this exception.

May be this issue should be discussed in postgress forum as well.

- Binod.

Dmitry Mozheyko wrote:

>Hello all.
>
>I use glassfish v2 build b27, postgresql 8.2, postgresql-8.2-504.jdbc4.jar(JDBC4 Driver)
>
>After JDK updating to 6 version my code:
>
>com.sun.appserv.jdbc.DataSource ds = (com.sun.appserv.jdbc.DataSource)context.lookup("dataSource");
>
>Connection connection = ds.getConnection();
>
>throws Exception:
>
>[#|2006-12-14T10:01:39.576+0300|WARNING|sun-appserver-ee9.1|javax.enterprise.resource.resourceadapter|_ThreadID=15;_ThreadName=httpSSLWorkerThread-8181-1;_RequestID=a2abed25-1eac-4d3d-8bb6-931b1911d7ab;|RAR7114: Unable to get ClientInfo for connection
>org.postgresql.util.PSQLException: Method org.postgresql.jdbc4.Jdbc4Connection.getClientInfo() is not yet implemented.
> at org.postgresql.Driver.notImplemented(Driver.java:728)
> at org.postgresql.jdbc4.AbstractJdbc4Connection.getClientInfo(AbstractJdbc4Connection.java:73)
> at org.postgresql.jdbc4.Jdbc4Connection.getClientInfo(Jdbc4Connection.java:21)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection$ConnectionHandler.invoke(AbstractJdbc23PooledConnection.java:357)
> at $Proxy42.getClientInfo(Unknown Source)
> at com.sun.gjc.spi.jdbc40.ConnectionHolder40.getClientInfo(ConnectionHolder40.java:352)
> at com.sun.gjc.spi.jdbc40.ConnectionHolder40.init(ConnectionHolder40.java:80)
> at com.sun.gjc.spi.jdbc40.ConnectionHolder40.<init>(ConnectionHolder40.java:71)
> at com.sun.gjc.spi.jdbc40.Jdbc40ObjectsFactory.getConnection(Jdbc40ObjectsFactory.java:32)
> at com.sun.gjc.spi.ManagedConnection.getConnection(ManagedConnection.java:329)
> at com.sun.enterprise.resource.LocalTxConnectorAllocator.fillInResourceObjects(LocalTxConnectorAllocator.java:86)
> at com.sun.enterprise.resource.AbstractResourcePool.getResource(AbstractResourcePool.java:489)
> at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:235)
> at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:163)
> at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:312)
> at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:176)
> at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:152)
> at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateNonTxConnection(ConnectionManagerImpl.java:135)
> at com.sun.gjc.spi.base.DataSource.getNonTxConnection(DataSource.java:160)
> at mozheyko.dmitry.DBHelper.<init>(DBHelper.java:50)
> at mozheyko.dmitry.DBRealm.getDBHelper(DBRealm.java:47)
> at mozheyko.dmitry.DBLoginModule.authenticateUser(DBLoginModule.java:23)
> at com.sun.appserv.security.AppservPasswordLoginModule.login(AppservPasswordLoginModule.java:171)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
> at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
> at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
> at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
> at com.sun.enterprise.security.auth.LoginContextDriver.doPasswordLogin(LoginContextDriver.java:284)
> at com.sun.enterprise.security.auth.LoginContextDriver.login(LoginContextDriver.java:159)
> at com.sun.enterprise.security.auth.LoginContextDriver.login(LoginContextDriver.java:112)
> at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:448)
> at com.sun.web.security.RealmAdapter.authenticate(RealmAdapter.java:388)
> at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:238)
> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:538)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:186)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1032)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
> at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
> at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1032)
> at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:250)
> at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
> at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.processNonBlocked(DefaultProcessorTask.java:549)
> at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
> at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
> at com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask.process(SSLReadTask.java:397)
> at com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask.doTask(SSLReadTask.java:210)
> at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
> at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
>|#]
>
>
>How i can fix it?
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
>