File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Updatable ResultSet - getString works but getObject does not?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Updatable ResultSet - getString works but getObject does not??" Watch "Updatable ResultSet - getString works but getObject does not??" New topic
Author

Updatable ResultSet - getString works but getObject does not??

Shailan Mm
Greenhorn

Joined: Oct 06, 2004
Posts: 8
Hi

I am creating an updatable resultset and then going thru it to read the values in each row. When I use getObject() to get the column values for each row, I get nulls. However, when I use getString(), I get the correct values.
Also, if I create a regular statement, not using the updatable result set feature, the getObject() call works fine.

Why would this be happening? (code below)

Thanks
Shailan




[edited to add code tags]
[ December 07, 2004: Message edited by: Jeanne Boyarsky ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30309
    
150

Shailan,
What is the type of the database field? Also, what database are you using?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Shailan Mm
Greenhorn

Joined: Oct 06, 2004
Posts: 8
Hi Jeanne

Im using Oracle8i Enterprise Edition Release 8.1.6.0.0

The query does a select * from a table with the following field types. (all Nullable)

Type
------------
VARCHAR2(3)
VARCHAR2(5)
VARCHAR2(3)
VARCHAR2(6)
VARCHAR2(1)
VARCHAR2(6)
DATE
VARCHAR2(1)
VARCHAR2(2)
DATE
DATE
VARCHAR2(8)
VARCHAR2(20)
Jim Cheng
Greenhorn

Joined: Dec 08, 2004
Posts: 11
This is an interesting question.
I will try to duplicate the problem and figure out the reason if I have time.

Please also report back if you figure out the reason.


Jim
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30309
    
150

Shailan,
Strange. You are using Oracle's JDBC driver, right?
Shailan Mm
Greenhorn

Joined: Oct 06, 2004
Posts: 8
Yup. oracle.jdbc.driver.OracleDriver.
Shailan Mm
Greenhorn

Joined: Oct 06, 2004
Posts: 8
Has anyone else encountered this behavior?

Thanks
Shailan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updatable ResultSet - getString works but getObject does not??