• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

.getObject() and DATE fields

 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic