This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes CallableStatement throwing data conversion error (Oracle) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "CallableStatement throwing data conversion error (Oracle)" Watch "CallableStatement throwing data conversion error (Oracle)" New topic
Author

CallableStatement throwing data conversion error (Oracle)

Yan Lee
Ranch Hand

Joined: Sep 15, 2003
Posts: 94
Hi All:

I am using Oracle JDBC thin driver in my J2EE application. There is a CallableStatement that calls a stored proc on the data base.

One of the parameters passed to CallableStatement is a java.sql.Date. For that I am using stmt.setDate(1,updateDate). The code compiles fine but throws a number to character conversion error at runtime.

On further investigation, I found out that the CallableStatement class has only 2 setDate() methods and they use the parameter name as the first parameter-- void setDate(String parameterName, Date x) .

CallableStatement is a subclass of PreparedStatement that has a setDate(int parameterIndex, Date x). So obviously, method called must be on the PreparedStatement class.

MY QUESTION:
How to use the setDate(String parameterName, Date x) method? Specifically, what should I put for parameter name? Is it the parameter as named in the stored proc? Has anyone encountered this issue? How was it solved?

Thanks in advance.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: CallableStatement throwing data conversion error (Oracle)
 
Similar Threads
Need a disconnected resultset
java.sql.SQLException: ORA-01858: a non-numeric character was found where a numeric
Comparing two Dates
Callable Statement
Oracle JDBC Thin Client behaviour concerning date data types and it's format.