Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MS SQL SERVER StTORED PROCEDURE

 
Govind battacharya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using MS SQL Server and Java
How can i use IN and Out Parameters when i am calling SQL SERver Stored procedure. I am using the following method,
con1=DriverManager.getConnection("jdbc dbc:mydsn","uid","pwd");
CallableStatement cs = con1.prepareCall("{call showEcode}");
ResultSet rs = null;
rs = cs.executeQuery();
in the above i want to pass as string paramenter and similaryly i want to receive a string parameter
ShowEcode is the SQL Server Procedure
but i dont't know how to use IN and Out Parameters(both are string) in the above.
can anybody help me?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
subub sububs
Welcome to Javaranch!
We have a Naming Policy here at the Ranch and since us Barkeeps have nothing better to do than pick on the newbies, we'd like you to conform a bit to our policies. You can change your display name here
Thanks, and again, welcome to the Ranch!!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I am not 100% sure about this, but have you tried the Stored Procedure Syntax as in
call showEcode @someParam = 'something'
And the result set should get whatever that returns.
I only have MySQL available right now which doesn't support SP, so I can't test that.
[ September 25, 2003: Message edited by: Gregg Bolinger ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic