Re: JDBC driver - first impressions and comments

From: Fernando Nasser <fnasser(at)redhat(dot)com>
To: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC driver - first impressions and comments
Date: 2002-12-04 19:37:55
Message-ID: 3DEE5993.5010505@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

j.random.programmer wrote:> Folks:
>
> 1) postgres' JDBC does not *seem* to have a "owner" or
> a person finally responsible for the driver. (at least
> I haven't found this going thru the archives). This
> simply may be how jdbc development is done by many
> people but ultimately someone has to be responsible
> for it. That somone then should be mentioned as the
> contact person for all JDBC development requests and
> bug reports.
>

Just post to the list and they will see it. (I am not one of them).

> 2) The jdbc compliance test results page has not been
> updated for quite some time. It's not clear how
> compliant the latest drivers are and if they are ready
> for serious production use.
>

I will see if can find some time and work on that. But lots of things depend on
the PostgreSQL backend which, BTW, as of 7.3 is far more SQL compliant than
MySQL (has schemas and everything).

> 3) I am getting exceptions when I call the following
> methods:
>
> md.supportsSavepoints()
> md.supportsGetGeneratedKeys()
>

You are right. I believe they should just return false. I will investigate and
post a patch.

> 4) The md.getColumnInfo() returns "int2" and "int4"
> for the TYPE_NAME field in the result set
> (corresponding to columns defined as smallint and
> integer). These should be "smallint" and "integer"
> instead.
>

User error ;-) This is the "Data source dependent type name".

You want the DTA_TYPE, which gives you the equivalent SQL Type.

> 5) The md.getColumnInfo() returns a result set in
> which the columns are sorted by column *name* and not
> by the ORDINAL_POSITION field. This is opposite of the
> JDBC spec which requires that columns be sorted by the
> ORDINAL_POSITION field. If I create a table such as:
>
> create table foo ( zoo int, abc int, baba timestamp);
>
> I should get my columns in the following order: [zoo,
> abc, baba] but getColumnInfo() returns them as: [abc,
> baba, zoo]
>
> Note, getColumnInfo() does return the correct
> ORDINAL_POSITION data each column but sorts them by
> alpha - which is wrong. Moreover, all returned
> columns are in all-lowercase [this may be the correct
> behavior - I don't know, but if I create a column
> fooBAR, JDBC returns that as foobar].
>

A patch has just been posted to fix it. But thanks for reporting it anyway.

As for case, PostgreSQL stores everything as lowercase unless you use "delimited
identifiers" (which allow mixed case, spaces etc. -- I would stay away from
them, it is not portable). The SQL standard is case insensitive and despite the
examples showing things in uppercase that is nothing that requires that
explicitly, just that 'fooBAR' is exactly the same thing as 'FOObar'.

I will let someone else reply to the second half.

Thank you for giving PostgreSQL a try. If you persist a little you will soon
find that there are many features in it that you don't find in other Open Source
databases and that can be very handy.

Regards,
Fernando

--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Medi Montaseri 2002-12-04 19:40:22 Re: Backend message type 0x50 arrived while idle
Previous Message Andrew J. Kopciuch 2002-12-04 19:26:32 Re: Functions just dont want to work! [hard]

Browse pgsql-jdbc by date

  From Date Subject
Next Message Fernando Nasser 2002-12-04 19:42:44 Re: UTF encoding error
Previous Message Fernando Nasser 2002-12-04 19:28:27 Re: SocketClosedException