aspose file tools*
The moose likes JDBC and the fly likes java.sql.SQLException: Fail to convert to internal representation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: Fail to convert to internal representation" Watch "java.sql.SQLException: Fail to convert to internal representation" New topic
Author

java.sql.SQLException: Fail to convert to internal representation

joew weakers
Ranch Hand

Joined: Aug 21, 2003
Posts: 48
Hi there. I am trying to execute a simple sql select query using an Oracle JDBC driver but keep encountering an error when I try to access a long value from the OracleResultSet generated. My select statement requests two
int values and one long value from one simple table. The error I get is as follows:

java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)

My code looks as follows:



Can anybody see the problem here. Thansk a lot, joe
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30512
    
150

Joe,
Can you show the select statement and schema? Also try using rs.getString(3) to make sure you can retrieve the data unformatted.

This isn't the problem, but it's good to use ResultSet instead of OracleResultSet. It makes your code more portable.
[ May 23, 2005: Message edited by: Jeanne Boyarsky ]

[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
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1132

Joe,
Use "getString()" instead of "getLong()".

Good Luck,
Avi.
bill tang
Greenhorn

Joined: May 20, 2005
Posts: 1
 
jQuery in Action, 2nd edition
 
subject: java.sql.SQLException: Fail to convert to internal representation