File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark ""Could not find stored procedure" exception" Watch ""Could not find stored procedure" exception" New topic
Author

"Could not find stored procedure" exception

Chris Y Chen
Greenhorn

Joined: Apr 23, 2008
Posts: 2

Hi All,

I've been struggling with trying to call a stored procedure on MSSQL server. Everytime I use CallableStatement to call the stored procedure, I get:

com.microsoft.sqlserver.jdbc.SQLServerException: Could not find stored procedure 'TESTDB.dbo.PROCESSING'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(Unknown Source)
...

I am using Microsoft SQL Server 2005 driver "sqljdbc_1.2".

What puzzles me is that I can successfully invoke the stored procedure using MyEclipse Database Explorer, which uses the same connection driver and connection string.

Does anyone know what can be the cause of the exception?

Any suggestion is appreciated!

Thanks,
Chris

Here's the code:

Sathi Krishna
Ranch Hand

Joined: Oct 21, 2007
Posts: 51

Just try with

statement = connection.prepareCall("{call TESTDB.dbo.PROCESSING(?,?)}");
or
statement = connection.prepareCall("{call dbo.PROCESSING(?,?)}");
or
statement = connection.prepareCall("{call PROCESSING(?,?)}");

May be your storedprocedure resides in different schema.
Chris Y Chen
Greenhorn

Joined: Apr 23, 2008
Posts: 2

Thanks for your suggestion.
I've tried different combinations just like you suggested but have gotten the same exception.

statement = connection.prepareCall("{call TESTDB.dbo.PROCESSING(?,?)}");
or
statement = connection.prepareCall("{call dbo.PROCESSING(?,?)}");
or
statement = connection.prepareCall("{call PROCESSING(?,?)}");

I was able to run
Execute TESTDB.dbo.PROCESSING '1234567890' 'TEST';
Execute dbo.PROCESSING '1234567890' 'TEST';
Execute PROCESSING '1234567890' 'TEST';
on MyEclipse Database Explorer and they all produce the right result.

I still can't get the CallableStatement to work...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "Could not find stored procedure" exception
 
Similar Threads
prepareCall error
help: null pointer exception
How to catch Oracle error codes and error message
Null pointer exception
PLS-00201: identifier 'SEC_LBIC.LDAP_VIEW_APP_LIST' must be declared