jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes returning value of ResultSetMetaData.getColumnType(int column) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "returning value of ResultSetMetaData.getColumnType(int column) " Watch "returning value of ResultSetMetaData.getColumnType(int column) " New topic

returning value of ResultSetMetaData.getColumnType(int column)

Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
can anybody tell me what will ResultSetMetaData.getColumnType(int column)
returns. It returns an integer, what is that integer. For eg. for column type Varchar2 it returned 12.
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

You should not rely on the actual int value but on the constants defined in java.sql.Types
[This message has been edited by JUNILU LACAR (edited August 23, 2001).]

Junilu - [How to Ask Questions] [How to Answer Questions]
Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Hi Junilu,
Could you explain further, I didn't understand what is the interger type of column type. I mean if it is string what it should return, if it is 'Date' type what should this method return.
Manjunath Reddy
Ranch Hand

Joined: Jul 26, 2001
Posts: 60
Check out the static constants that are defined in the class java.sql.Types.
One of these static integer constants is what is returned by getColumnType(int c).
hope this clarifies...
John Kilbourne
Ranch Hand

Joined: Aug 22, 2001
Posts: 30
Ivor Horton's chapter of his Beginning Java book, on JDBC is on the web, I think at the Sun site. He explains this very well. It's in PDF, or I would paste an excerpt here.
"The Types class in the java.sql package defines public fields of type int that identify the SQL types, and the names of these class data memebers are the same as the SQL types they represent -- such as CHAR,VARCHAR, DOUBLE..."

I agree. Here's the link: http://aspose.com/file-tools
subject: returning value of ResultSetMetaData.getColumnType(int column)
It's not a secret anymore!