Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Could not find stored procedure" exception

 
Chris Y Chen
Greenhorn
Posts: 2
Java MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
Java MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic