Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Fri, 30 Jul 2004 10:14:29 +1200
  • Message-id: <410976C5.2050600@opencloud.com> <text/plain>

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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group