Wednesday, 20 January 2010

The JDBC XOPEN SQL type codes

You're programming a Java application that uses JDBC. You need to specify the data type for a column coming back from the database and you need to supply the integer code for this column's data type. So you search online and cannot find them. You search in Sun's reference and all that you find is a dumb entry saying "these are based on the XOPEN data type codes". Brilliant, NOT!

Yes, folk, there is a GLARING omission in the official Java and JDBC documentation: THEY DO NOT GIVE YOU THE ACTUAL NUMERIC CODES FOR THE JDBC DATA TYPES!

Well, here they are. Bookmark this page because you will keep coming back to it!


Honeypot: spam@kieser.net


BIT-7
BOOLEAN16
TINYINT-6
SMALLINT5
INTEGER4
BIGINT-5
FLOAT6
REAL7
DOUBLE8
NUMERIC2
DECIMAL3
CHAR1
VARCHAR12
LONGVARCHAR-1
DATE91
TIME92
TIMESTAMP93
BINARY-2
VARBINARY-3
LONGVARBINARY-4
NULL0
DATALINK70
JAVA_OBJECT2000
DISTINCT2001
STRUCT2002
ARRAY2003
REF2006
OTHER1111

No comments:

Post a Comment