• 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

Problem with getObject() method of ResultSet

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have got a major problem. Please help.
I am using Oracle9i with Weblogic 8.1 SP4. I am using:
oracle.jdbc.driver.OracleDriver drivers.
URL starts with: jdbc racle:thin
In database, I am having two fields with data type "Date" and "Number".
Now, When I am fetching data from database, I am using getObject() method of ResultSet. As per my knowledge, This method should return the object of Date and Object of Integer in java types. After fetching object, In my java class, I am casting the values as follows:

BigDecimal bd=(BigDecimal)resultset.getObject("ProjectID");
//On above line I tried instanceof operator to check if it returns object of BigDecimal. It returns me true. Casting working fine here.

Timestamp ts=(Timestamp)resultset.getObject("ProjectStartDate");
//On above line I tried instanceof operator to check if it returns object of Timestamp. It returns me false. It is returning the object of class Object. Casting is not working here. It is giving me ClassCastException at runtime.

Can somebody suggest why it is happening.?
The code was working fine with weblogic 8.1 SP2. Is there some problem of drivers OR something else?
Please help as it is very urgent. Thanks in Advance.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think you can easily find out this issue by your-self !

look at what type of object the method return to you
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you using getObject instead of, say, getTimestamp?
 
Bring out your dead! Or a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic