This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes Stored proceduresand sql-server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Stored proceduresand sql-server" Watch "Stored proceduresand sql-server" New topic
Author

Stored proceduresand sql-server

suzi lu
Greenhorn

Joined: Jan 05, 2001
Posts: 17
I have a stored proc which takes 5 parameters , does some manipulation and returns me a record set.How do i call that in JDBC?
callablestatement c = stmt.preparecall("call sp_myproc(?,?,?,?,?)")
and say setXXX for all the five parameters....and say
resultset rs = c.execute()
and then manipulate the resultset???
Am i correct???
Pl help...
Tx,
Suzi
John Bateman
Ranch Hand

Joined: Mar 09, 2000
Posts: 320
Hey
My only comment to you would be.. what happens when you actually do that?
Let us know IF it doesn't work.


SOURCE CODE should be SURROUNDED by "code" tags.
suzi lu
Greenhorn

Joined: Jan 05, 2001
Posts: 17
I mean if I have a stored proc returning a resultset, taking in 5 parameters, then do i have to say, c.registeroutparameter for resultset???(i would say setXXX() for input params anyways)
Pl help me
Tx,
Suzi
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
then do i have to say, c.registeroutparameter for resultset???
That's only used if your parameters are defined as out or inout parameters. Your original post had all the required steps.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Stored proceduresand sql-server
 
Similar Threads
getting ResultSet from Oracle procedure
@NamedNativeQuery and choosing the correct resultClass
JDBC
Stored Procedures
How resultset is returned by stored procedure?