Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002
    Location
    Italy
    Posts
    9

    Unanswered: Calling a stored procedure from JDBC

    Hi to all...
    Suppose I have a stored procedure that makes an update AND a query that gives back a resultset.
    Suppose I have to call this stored procedure by Java JDBC.
    How can I execute the update and retrieve the resultset?
    If I use executeUpdate(), I'll get back an int; if I use executeQuery(), I'll get back a resultset, but will the update part be processed?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    You should be using: java.sql.CallableStatement.
    Use executeQuery to get the Result Set. Have the update process return its result using an OUT parameter of the SP. YOu can then get the value of the OUT parameter after the call to the executeQuery.

    HTH

    Andy

  3. #3
    Join Date
    Oct 2002
    Location
    Italy
    Posts
    9

    Thumbs up

    Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •