File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid parameter binding(s).

 
Ameya Thakur
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic