Thread: JDBC ResultSetMetaData.getColumnType and getColumnTypeName work properly?
If I create a table thus: CREATE TABLE title ( title text NOT NULL, editions int4[] ); and through the JDBC ResultMetaData.getColumnType() interface try to get the type of the 'editions' column, I get the value sql.Types.OTHER. I would have guessed it would have been Types.ARRAY. Am I missing something? Also getColumnTypeName() returns _int4; is that correct? Shankha Mitra As an aside, I decided to print out the values of all the JDBC types and I get: ARRAY=2003 BIGINT=-5 BINARY=-2 BIT=-7 BLOB=2004 CHAR=1 CLOB=2005 DATE=91 DECIMAL=3 DISTINCT=2001 DOUBLE=8 FLOAT=6 INTEGER=4 JAVA_OBJECT=2000 LONGVARBINARY=-4 LONGVARCHAR=-1 NULL=0 NUMERIC=2 OTHER=1111 REAL=7 REF=2006 SMALLINT=5 STRUCT=2002 TIME=92 TIMESTAMP=93 TINYINT=-6 VARBINARY=-3 VARCHAR=12
Re: [INTERFACES] JDBC ResultSetMetaData.getColumnType and getColumnTypeName work properly?
From
Peter T Mount
Date:
On Fri, 25 Dec 1998, Shankha Mitra wrote: > If I create a table thus: > > CREATE TABLE title ( > title text NOT NULL, > editions int4[] > ); > > and through the JDBC ResultMetaData.getColumnType() interface try to get > the > type of the 'editions' column, I get the value sql.Types.OTHER. I would > have > guessed it would have been Types.ARRAY. Am I missing something? Yes, there is no constant of Types.ARRAY in JDBC (see below). The implementation sets the type to OTHER if it doesn't recognise it. > Also getColumnTypeName() returns _int4; is that correct? no, it should return String - will check. > Shankha Mitra > > > As an aside, I decided to print out the values of all the JDBC types and > I get: > ARRAY=2003 In JDBC2 2003 equates to the new value Types.REF (atleast in my copy of the documentation), and there is no ARRAY type. What JDK are you using? Looking at these values, 2000 and higher are introduced in 1.2 so they will not yet be supported. Currently JDK2 (formerly 1.20 is not supported. I'm about to start work on this today - having to revert to Win95 to do it though :-( ) > BIGINT=-5 > BINARY=-2 > BIT=-7 > BLOB=2004 > CHAR=1 > CLOB=2005 > DATE=91 > DECIMAL=3 > DISTINCT=2001 > DOUBLE=8 > FLOAT=6 > INTEGER=4 > JAVA_OBJECT=2000 > LONGVARBINARY=-4 > LONGVARCHAR=-1 > NULL=0 > NUMERIC=2 > OTHER=1111 > REAL=7 > REF=2006 > SMALLINT=5 > STRUCT=2002 > TIME=92 > TIMESTAMP=93 > TINYINT=-6 > VARBINARY=-3 > VARCHAR=12 -- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres Java PDF Generator: http://www.retep.org.uk/pdf
Re: [INTERFACES] JDBC ResultSetMetaData.getColumnType and getColumnTypeName work properly?
From
"Shankha S. Mitra"
Date:
Aah, that explains it. I'm using JDK 1.2 beta4 (which I guess _is_ now JDK 2.0). THe JDBC in JDK 2.0 does have ARRAY, etc. Thanks for the reply. Shankha Peter T. Mount writes: > Yes, there is no constant of Types.ARRAY in JDBC (see below). The > implementation sets the type to OTHER if it doesn't recognise it. > > > Also getColumnTypeName() returns _int4; is that correct? > > no, it should return String - will check. > > > Shankha Mitra > > > > > > As an aside, I decided to print out the values of all the JDBC types and > > I get: > > ARRAY=2003 > > In JDBC2 2003 equates to the new value Types.REF (atleast in my copy of > the documentation), and there is no ARRAY type. > > What JDK are you using? Looking at these values, 2000 and higher are > introduced in 1.2 so they will not yet be supported. > > Currently JDK2 (formerly 1.20 is not supported. I'm about to start work on > this today - having to revert to Win95 to do it though :-( ) > -- ------------------------------------------------------------------- Shankha S. Mitra shankha@antrim.com Principal Software Engineer ph: (+1) 831.430.4814 Antrim Design Systems fax: (+1) 831.430.1904 Scotts Valley, CA -------------------------------------------------------------------
Re: [INTERFACES] JDBC ResultSetMetaData.getColumnType and getColumnTypeName work properly?
From
Peter T Mount
Date:
On Mon, 28 Dec 1998, Shankha S. Mitra wrote: > Aah, that explains it. I'm using JDK 1.2 beta4 (which I guess _is_ now > JDK 2.0). THe JDBC in JDK 2.0 does have ARRAY, etc. Ah, just checked my JDK2 html docs, and yes, ARRAY does exist. Figures that the SUN produced paperback of all the API's doesn't show it :-( Anyhow, at this precise moment, I'm downloading Cygwin B20.1 so I have GNU-Make available. That way I can tie in the Makefile ready for working on the JDBC2 version of the driver. > Thanks for the reply. > Shankha > > > Peter T. Mount writes: > > Yes, there is no constant of Types.ARRAY in JDBC (see below). The > > implementation sets the type to OTHER if it doesn't recognise it. > > > > > Also getColumnTypeName() returns _int4; is that correct? > > > > no, it should return String - will check. > > > > > Shankha Mitra > > > > > > > > > As an aside, I decided to print out the values of all the JDBC types and > > > I get: > > > ARRAY=2003 > > > > In JDBC2 2003 equates to the new value Types.REF (atleast in my copy of > > the documentation), and there is no ARRAY type. > > > > What JDK are you using? Looking at these values, 2000 and higher are > > introduced in 1.2 so they will not yet be supported. > > > > Currently JDK2 (formerly 1.20 is not supported. I'm about to start work on > > this today - having to revert to Win95 to do it though :-( ) > > > > -- > ------------------------------------------------------------------- > Shankha S. Mitra shankha@antrim.com > Principal Software Engineer ph: (+1) 831.430.4814 > Antrim Design Systems fax: (+1) 831.430.1904 > Scotts Valley, CA > ------------------------------------------------------------------- > -- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres Java PDF Generator: http://www.retep.org.uk/pdf
Re: [INTERFACES] JDBC ResultSetMetaData.getColumnType and getColumnTypeName work properly?
From
Peter T Mount
Date:
On Mon, 28 Dec 1998, Shankha S. Mitra wrote: > Aah, that explains it. I'm using JDK 1.2 beta4 (which I guess _is_ now > JDK 2.0). THe JDBC in JDK 2.0 does have ARRAY, etc. > > Thanks for the reply. > Shankha > > > Peter T. Mount writes: > > Yes, there is no constant of Types.ARRAY in JDBC (see below). The > > implementation sets the type to OTHER if it doesn't recognise it. > > > > > Also getColumnTypeName() returns _int4; is that correct? > > > > no, it should return String - will check. I think the int4 is what it's translating the postgresql type as. I've not tried Arrays with JDBC yet, but I think we can fix this when we implement ARRAY. -- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres Java PDF Generator: http://www.retep.org.uk/pdf