File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
getting column type info from db
Joined: Oct 28, 2008
Dec 23, 2008 13:20:00
I want to get the
info from the DB for a given column name.
is this really the best way to do this:
dbMeta = conn.getMetaData();
cols = dbMeta.getColumns(null, null, tablename, columnname);
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.
Vinod K Singh
Joined: Sep 30, 2008
Dec 24, 2008 08:48:00
is the standard way to get such information. BTW indexes start from 1 not from 0.
I agree. Here's the link:
subject: getting column type info from db
IS NULL selection to CMP Entity EJB from DB
Probs with Sybase
How get rowId in a select statement?
setting default value for a column
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014