"Fail to convert to internal representation" Error

B

Benji

Hi guys,

I'm getting this error:

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

When trying to prepare a statement in Java using the
OracleJDBC_classes12.jar

Code is:

String query =
"SELECT " + DB_VIEW_SPOTRANGES + "." + DB_FIELD_DOCUMENTID + ", "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_BIPRODUCT + ", "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_MINTRADE + ", "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_MAXTRADE + ", "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_CLOSESPOT + ", "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_REPORTDATE + ", "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_TIMEZONE + ", "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_VERIFIED

+ " FROM " + DB_VIEW_SPOTRANGES
+ " WHERE " + DB_VIEW_SPOTRANGES + "." + DB_FIELD_DOCUMENTID
+ " = ? ORDER BY "
+ DB_VIEW_SPOTRANGES + "." + DB_FIELD_BIPRODUCT;

Which I can see from my logs becomes

SELECT SPOTRANGES.DocumentID, SPOTRANGES.Biproduct,
SPOTRANGES.MinTrade, SPOTRANGES.MaxTrade, SPOTRANGES.CloseSpot,
SPOTRANGES.ReportDate, SPOTRANGES.TimeZone, SPOTRANGES.Verified FROM
SPOTRANGES WHERE SPOTRANGES.DocumentID = ? ORDER BY
SPOTRANGES.Biproduct

.....

Prepared stmt = dbConn.prepareStatement(query);
BigDecimal b = new BigDecimal(documentID);
ResultSet rslt = stmt.executeQuery();

....where documentID is an "int"

I've looked about and I seem to be doing the right thing. This is how
I've approached the problem in the past.

Any ideas?
 
S

Sudsy

Benji said:
Prepared stmt = dbConn.prepareStatement(query);
BigDecimal b = new BigDecimal(documentID);
ResultSet rslt = stmt.executeQuery();

...where documentID is an "int"

I've looked about and I seem to be doing the right thing. This is how
I've approached the problem in the past.

Any ideas?

PreparedStatement stmt = dbConn.prepareStatement( query );
BigDecimal b = new BigDecimal(documentID);
stmt.setBigInteger( 1, b );
ResultSet rslt = stmt.executeQuery();
 
B

Bjorn Abelli

...
Prepared stmt = dbConn.prepareStatement(query);
BigDecimal b = new BigDecimal(documentID);
ResultSet rslt = stmt.executeQuery();

...where documentID is an "int"

It looks to me as at least one line is missing. Have you tried:

PreparedStatement stmt = dbConn.prepareStatement(query);
stmt.setInt(1, documentID);
ResultSet rslt = stmt.executeQuery();

// Bjorn A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top