Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

stored procedure not working nor throwing exception when called from Java application

 
michael tall
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Above code is not throwing any exception nor giving any resultset when called from Java app.
I logged into the Database Manager and saw if there are any records matching the given parameter. There is one record. Unable to figure out the cause
 
Campbell Ritchie
Sheriff
Posts: 48440
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. It might be worth posting the text of the stored procedure; people will be better able to help then.
 
michael tall
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,
When I want to execute a stored procedure from JDBC, I use method "execute()" and not "executeQuery()".
I could not ascertain, from your post, the database you are using.
The stored procedure code you posted does not look like PL/SQL, so I assume you are not using Oracle, so I may be mistaken in what I am about to say, but it looks to me like your stored procedure does not return anything.
If it does return something, then your java code needs to invoke method "registerOutParameter()".

Good Luck,
Avi.
[ November 26, 2008: Message edited by: Avi Abrami ]
 
Campbell Ritchie
Sheriff
Posts: 48440
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the @ mean before Person_name? Does that make it a global variable or something? I can't remember, but that might cause problems.

Surely the result set is equivalent to what is found in the select?
 
michael tall
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without @ the stored procedure was not compiling in Database Manager. I changed the code as below:. But I don't know how to set the first parameter.
 
Campbell Ritchie
Sheriff
Posts: 48440
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems odd that you had to use an @. Find the stored procedure part of the instructions for your database program and see what that says. Probably better to get the procedure working from the command line first.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic