Don't use Object
, but just use the type which is associated with the datatype in question. You can find here more detailed information about which Java object types you should be using for certain DB datatypes with under each this table:
Alternatively, you can use DatabaseMetaData#getColumns()
to figure the column information (column name, datatype, size, maxlength, nullable, etc).
There are lot of other methods which may be of use, e.g. getIndexInfo()
to figure all indexes, the getPrimaryKeys()
to figure the PK's, the getExportedKeys()
to figure the FK's, etcetera. Just poke a bit round in the whole DatabaseMetaData
API to find that you need.
BalusC
2010-04-20 21:16:17