aspose file tools*
The moose likes JDBC and the fly likes Invalid parameter binding(s). Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invalid parameter binding(s)." Watch "Invalid parameter binding(s)." New topic
Author

Invalid parameter binding(s).

Ameya Thakur
Ranch Hand

Joined: Feb 04, 2004
Posts: 43
Hi !!!
I am wrting a small store Proc for inserting an value and fetching the Id for the value inserted.

i.e I have Id as an identity column (auto incremented) so i wanted to know the ID for which i am doing the insert operation.

My Store Proc goes like this

CREATE PROCEDURE dbo.spInsertStackTrace
(
@StackTraceLog as varchar (4000),
@StackTest as varchar (50),
@StackTraceId as int output
) AS BEGIN
Insert Into StackTrace(StackTraceLog,StackTest)
Values(@StackTraceLog,@StackTest)
Select @StackTraceId = MAX(StackTraceId) from StackTrace

END
GO

Java CODE

Persistor myPersistor = PersistorFactory.createPersistor("ccmaster");
CallableStatement cstmt = null;
cstmt = myPersistor.prepareCall("{call spInsertStackTrace(?,?,?)}");
cstmt.setString(1,"Edwards");
cstmt.setString(2,"Efiller");
cstmt.registerOutParameter(3,java.sql.Types.INTEGER);
cstmt.execute();
int stackTraceId = cstmt.getInt(3);
System.err.println("Stack Trace Id"+stackTraceId);


with the above code i am getting the following error..


java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).


It looks pretty simple i am just not able to figure how to register the out parameter..so would some one help me and update me that would be very very great.


Thanks a lot
-Ameya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid parameter binding(s).
 
Similar Threads
How to search record on (firstname+lastname) or (lastname+firstname)? please help me
Calling COBOL stored proc from Java Servlet
Are there any constraints on length of String?
what is the equivalent data type for Oracle Cursor.
Retrieving the output parameter from the CallableStatement