Re: Java Studio Creator and postgresql jdbc

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Jeremiah Jahn <jeremiah(at)cs(dot)earlham(dot)edu>
Cc: Matt Verran <matt(at)verranm(dot)fsnet(dot)co(dot)uk>, postgres jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Java Studio Creator and postgresql jdbc
Date: 2004-07-29 22:14:29
Message-ID: 410976C5.2050600@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Jeremiah Jahn wrote:
> bit of a repost here:
> I got the following from sun on this.
>
> Re: Supported DB Drivers
> Author: Valerie_Lipman
> Jul 25, 2004 2:02 PM
> (reply 4 of 4)
>
> We just tested postgresql in house and found that the driver is
> returning null for PreparedStatement.getMetaData()

The current driver returns null from getMetaData() if there is no active
resultset associated with the statement.

The javadoc says:

> Retrieves a ResultSetMetaData object that contains information about the
> columns of the ResultSet object that will be returned when this
> PreparedStatement object is executed.
>
> Because a PreparedStatement object is precompiled, it is possible to
> know about the ResultSet object that it will return without having to
> execute it. Consequently, it is possible to invoke the method
> getMetaData on a PreparedStatement object rather than waiting to execute
> it and then invoking the ResultSet.getMetaData method on the ResultSet
> object that is returned.

This is probably possible to implement when using a V3 connection
(server version >= 7.4) as we can send Parse/Bind/Describe/ClosePortal
to get a description of the portal without actually executing it. The
driver doesn't do this currently though.

I'd point out that it's probably the application at fault too. The
javadoc goes on to say:

> Returns:
> the description of a ResultSet object's columns or null if the
> driver cannot return a ResultSetMetaData object

So 'null' is actually a legal return value (in fact, we'll probably have
to continue returning null when using a V2 connection).

-O

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2004-07-29 22:20:44 Re: Bug in 7.4_213 driver: returns VARCHAR instead of
Previous Message Kris Jurka 2004-07-29 21:54:58 Re: Bug in 7.4_213 driver: returns VARCHAR instead of