Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes case Types.DATE Error -  urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "case Types.DATE Error -  urgent" Watch "case Types.DATE Error -  urgent" New topic

case Types.DATE Error - urgent

ravindra kunapuli

Joined: Oct 29, 2003
Posts: 2
I am writing a simple java program which connects to table in oracle.That table has a date type column. When i get the result i am creating an object for each column type using the switch case as follows:
switch (rsmd.getColumnType (i))
case Types.DATE:
case Typee.VARCHAR:
The problem is with date type column. the case statement (Types.DATE) is not true for date type columns. so it not going to the case and rather going to the default.
I was debugging it, and i have seen that the rsmd.getColumnType (i) will return a integer value of 93. But the case Types.DATE has (returns) a value of 91. So, it is not going to case Types.DATE. Did any one try this. I have a lot of pieces of code on net, and everyone is using the same case statement for date type columns. Can anyone help me in this urgently.
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
I don't have the source code for java.sql.Types handy, but I'd bet that 93 is Types.TIMESTAMP. Take a look at the source for this file, or write a quick program printing out Types.TIMESTAMP.
I agree. Here's the link:
subject: case Types.DATE Error - urgent
jQuery in Action, 3rd edition