Re: getTables is this right?

From: Peter Mount <peter(at)retep(dot)org(dot)uk>
To: Eric Frazier <ef(at)kwinternet(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: <pgsql-jdbc(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: getTables is this right?
Date: 2001-03-12 15:57:49
Message-ID: 5.0.2.1.0.20010312154909.0213a3d0@mail.retep.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

At 23:39 09/03/01 -0800, Eric Frazier wrote:

>Hi,
>
>I am having problems getting info on tables with getTables. I get null
>returned all of the time.

Where is it returning null? It should always return a result set.

>I was using this code
>
>snip:
>
>//String [] onlytables = new String[3];
> //onlytables[0] = "TABLE";
> //onlytables[1] = "INDEX";
> ResultSet tableRS =
>m_inputCon.getMetaData().getTables(null,null,"%",null);
>
>/* I had used the String [] onlytables in place of null, but I got
>
> java.sql.SQLException: ERROR: parser: parse error at or near ")"

Yes as you had a NULL in onlytables[2]. Change your array to String[2] and
it should work.

>Now when I read the JDBC API It says that the TABLE_NAME is column 3 and
>TABLE_TYPE should be column 4 in the getTables ResultSet.
>It looks to me like that is messed up with.
>
> f[2] = new Field(connection, "TABLE_NAME", iVarcharOid, 32);
> f[3] = new Field(connection, "TABLE_TYPE", iVarcharOid, 32);

No, the array f is 0 based, ie numbered from 0..4. JDBC is 1 based, so
column 1 maps to element 0 in the array. Don't ask why they made JDBC work
from 1 and not 0, it catches everyone out.

>I may be way off here, in my guessing, but I can't get getTables table type
>to return a type.
>
>I am using the 7.0 driver with the jar named 7.0-1.2.jar and Postgress 7.0.3
>on the server end.

That should work, and it seems to match what I've got running here.

>I hope I didn't get my versions messed up, but that is the other thing I am
>not certain about, what is the latest version of the driver and is it
>nessicarly in the current "latest" postgress download?

No, I'm trying to get things sorted, but my day job has to take priority at
the moment, hence I'm a bit behind with things.

Peter

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter Mount 2001-03-12 15:59:38 Re: callable statements, latest snapshot
Previous Message Peter Mount 2001-03-12 15:45:55 Re: JDBC build patches

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2001-03-12 16:47:48 Re: JDBC build patches
Previous Message Peter Mount 2001-03-12 15:45:55 Re: JDBC build patches