Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to call a sp in Sql server which has no Out parameter

User_CROFUOct 9 2012 — edited Nov 20 2014
Hi all,

I am trying to call a stored procedure in Sql Server through jdbc. The Stored Procedure has no out parameter in it. It has a select query at the end which retrieves some rows when

we execute the procedure. When I execute the procedure in the sql server I am able to see the output rows but when I am trying to invoke the SP I am getting an exception

pasted below:

Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:408)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
at sqlserverspcall.SqlServerSPCall.main(SqlServerSPCall.java:50)

Could it be because of not having Out parameter in the procedure. I guess the ResultSet comes only if the procedure has an Out parameter. Is there a way to get the output from

this kind of procedures. Please help me.

Thanks In Advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 9 2012
Added on Oct 9 2012
4 comments
1,204 views