aspose file tools*
The moose likes JDBC and the fly likes stored procedure not working nor throwing exception when called from Java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "stored procedure not working nor throwing exception when called from Java application" Watch "stored procedure not working nor throwing exception when called from Java application" New topic
Author

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

michael tall
Ranch Hand

Joined: Nov 02, 2008
Posts: 61

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

Joined: Oct 13, 2005
Posts: 39865
    
  28
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

Joined: Nov 02, 2008
Posts: 61
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1135

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

Joined: Oct 13, 2005
Posts: 39865
    
  28
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

Joined: Nov 02, 2008
Posts: 61
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

Joined: Oct 13, 2005
Posts: 39865
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: stored procedure not working nor throwing exception when called from Java application