Which Java and java.sql data types map to my specific database types?
Created May 7, 2012
You can also ask the driver and DBMS for this information programmatically, which should be the final word. See How do I extract SQL table column type information? and the examples TypeInfo.java, DataType.java and CreateNewTable.java in the JDBC API Tutorial and Reference, Second Edition. ( For download information, see Are the code examples from the JDBC API Tutorial and Reference, Second Edition available online?. ) These examples deal generically with the DatabaseMetaData.getTypeInfo method. Some of this information, like column type and DBMS specific type name, is also available from ResultSetMetaData for specific columns.
Additionally, with JDBC 2.0 drivers that support the method ( not all do ), ResultSetMetaData also has a getColumnClassName method available.