File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.getObject() and DATE fields

 
Joel McNary
Bartender
Posts: 1824
Eclipse IDE Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, I had this experience...

I have a generic ResultSet processor that simply takes a result set and creates a list of Maps mapping the column name to the data. This relies heavily on the .getObject() method in ResultSet.

In Oracle 9i and the ojdbc14.jar oracle driver, when I create a query that
returns the value of a DATE field, .getObject() returned a java.sql.Timestamp object.

However, a co-worker had the oracle92.jar slip into his classpath. Apparently there is a driver in that .jar file, and it functions differently -- .getObject() returns an internal Oracle Timestamp type. We removed that .jar file and everything works now, but while we were investigating we found some evidence that this would be the functionality for the Oracle driver going forward (for the drivers for 10g, etc). Now, I don't remember the reference that we found that stated that so I can't reference it here, but my question is basically: Is that correct? And should we be using the oracle92.jar or the ojdbc14.jar?
 
Kevin Conaway
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joel,

Just as an aside, I am using ojdbc14.jar on an Oracle 9.2.0.4 database and getObject() returns an oracle.sql.Timestamp object (I think) for me.

Kevin
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joel McNary:
Is that correct? And should we be using the oracle92.jar or the ojdbc14.jar?


I would go for ojdbc14.jar because not using vendor specific classes is encouraged, until you really want to. As you stated that oracle92.jar is giving you oracle timestamp, I never came across though. Thus, I wouldn't go for it.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic