The Artima Developer Community
Sponsored Link

Java Answers Forum
CallableStatement

3 replies on 1 page. Most recent reply: Sep 26, 2003 9:21 AM by sabab

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
sabab

Posts: 34
Nickname: sabab
Registered: Aug, 2003

CallableStatement Posted: Sep 25, 2003 9:27 AM
Reply to this message Reply
Advertisement
How can i get values from resultset using callablestatemnet
i am attaching my code here

con1=DriverManager.getConnection("jdbc:odbc:dsn1","username","pwd");
CallableStatement cs = con1.prepareCall("{call showEcode}");
ResultSet rs = null;
rs = cs.executeQuery();

in the above code ShowEcode is a SQL Server Stored Procedure
i want to pass a string to this proceudre as an inputparameter and a string as output parameter

pls help


Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: CallableStatement Posted: Sep 25, 2003 4:29 PM
Reply to this message Reply
If you do a simple google you will find enough resources for this

Shekhar

Posts: 11
Nickname: shekhar4u
Registered: Aug, 2003

Re: CallableStatement Posted: Sep 26, 2003 4:00 AM
Reply to this message Reply
Hi try this code:

con1=DriverManager.getConnection("jdbc:odbc:dsn1","username","pwd");
CallableStatement cs = con1.prepareCall("{call showEcode(?,?)}");
cs.setString(1,urinputstring);
cs.registerOutParameter(2,Typ es.VARCHAR);
ResultSet rs = null;
rs = cs.executeQuery();
String outValue = cs.getString(2)

it will work....check out

sabab

Posts: 34
Nickname: sabab
Registered: Aug, 2003

Re: CallableStatement Posted: Sep 26, 2003 9:21 AM
Reply to this message Reply
Thanx,, yes it is working

Flat View: This topic has 3 replies on 1 page
Topic: Abt prepared statement? Previous Topic   Next Topic Topic: Displayin an integer in an applet

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use