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

procedure call

 
Tmmet Johnson
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyone help me out?
I am getting error - Invalid cursor state. SQLSTATE=24000 when i run the below code.
It is faling when the shile loop is called.
Any ideas/suggesstions to resolve the issue would be very helpful for me.

final String procedure = "CALL db2test.testdata(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
stmt = conn.prepareCall(procedure);
stmt.setShort(1, 1);
stmt.setString(2, "1234567890");
stmt.setString(3, "12345"));
stmt.registerOutParameter(4, Types.CHAR);
stmt.registerOutParameter(5, Types.INTEGER);
stmt.registerOutParameter(6, Types.CHAR);
stmt.registerOutParameter(7, Types.CHAR);
stmt.registerOutParameter(8, Types.CHAR);
stmt.registerOutParameter(9, Types.CHAR);
stmt.registerOutParameter(10,Types.CHAR);
stmt.registerOutParameter(11, Types.CHAR);
stmt.registerOutParameter(12, Types.CHAR);
stmt.registerOutParameter(13, Types.CHAR);
stmt.registerOutParameter(14, Types.CHAR);
stmt.registerOutParameter(15, Types.CHAR);
stmt.registerOutParameter(16, Types.CHAR);
stmt.registerOutParameter(17, Types.CHAR);

ResultSet rs = stmt.executeQuery();
output.setData(stmt.getString(4));
output.setData1(new Integer(stmt.getInt(5)).toString());
output.setData2(stmt.getString(6));
output.setDaat3(stmt.getString(7));
output.setData4(stmt.getString(8));
output.setData5(stmt.getString(9));
output.setData5(stmt.getString(10));
output.setData6(stmt.getString(11));
output.setData7(stmt.getString(12));
output.setDaat8(stmt.getString(13));
output.setData9(stmt.getString(14));
output.setData10(stmt.getString(15));
output.setData11(stmt.getString(16));
output.setData12(stmt.getString(17));
while(rs.next())
{
short code = rs.getShort(1);
String id = rs.getString(2);
System.out.println("ID is : "+ i);l
}
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our JDBC forum.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33699
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
output.setData(stmt.getString(4));

What does this code do?

Also what does the stored procedure do? Does it return a single result set?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic