posted 15 years ago
I want to get the java.sql.Types info from the DB for a given column name.
is this really the best way to do this:
DatabaseMetaData dbMeta = conn.getMetaData();
ResultSet cols = dbMeta.getColumns(null, null, tablename, columnname);
ResultSetMetaData rsMeta = cols.getMetaData();
int colType = rsMeta.getColumnType(0); // Hopefully only have one row
This seems very ugly! Is there an easier way. I am also not checking for null objects along the way which I should probably do which would make this more ugly.
Any ideas?
Thanks,
Billy