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

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbcpgsql-patches
At 23:39 09/03/01 -0800, Eric Frazier wrote:

>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
>//String [] onlytables = new String[3];
>             //onlytables[0] = "TABLE";
>             //onlytables[1] = "INDEX";
>             ResultSet tableRS =
>/* 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.


In response to

pgsql-patches by date

Next:From: Peter EisentrautDate: 2001-03-12 16:47:48
Subject: Re: JDBC build patches
Previous:From: Peter MountDate: 2001-03-12 15:45:55
Subject: Re: JDBC build patches

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group