Re: getTables is this right?
От | Peter Mount |
---|---|
Тема | Re: getTables is this right? |
Дата | |
Msg-id | 5.0.2.1.0.20010312154909.0213a3d0@mail.retep.org.uk обсуждение исходный текст |
Ответ на | getTables is this right? (Eric Frazier <ef@kwinternet.com>) |
Список | pgsql-jdbc |
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
В списке pgsql-jdbc по дате отправления: