SQLServerException: The statement did not return a result set
-
giovedì 3 maggio 2012 17:59
Hi,
Before I post this question, I have searched the above topic "SQLServerException: The statement did not return a result set" both in Internet and this forum, however, I still can't figure out what problem I encountered in my program.
The background like this, we have a set of java web systems running on websphere 6.1 and systems connect to SQL Server 2000 using its embedded SQL 2000 JDBC driver.
Now, we need to upgrade websphere to 8.0 and back end database to SQL Server 2008 R2. The original SQL server 2000 JDBC driver no longer work. So we download SQL Server JDBC 3.0 and try on our systems. Then when executing some Stored Proc (SP) in SQL Server, JDBC returns "SQLServerException: The statement did not return a result set". Then we search on Internet and found "update statement" in SP will generate a resultset and developer needs to use "Statement.getMoreResults()" can fix this. We tried "Statement.getMoreResults()" and it really overcome this exception. This test was carried out in our original system codes.
However, when we try to minimze the scope and exact this SP part and run in another test project, executing the same piece of codes on SP but it does not generate any error and the query returns resultset normally.
I really have no idea why? Is it possible that running other codes that would cause the following JDBC codes to produce such exception?
Does anyone has similar experience?
If yes, please help to share! Many Thanks.
Ray
- Modificato Raymond Lee chun man giovedì 3 maggio 2012 18:04
Tutte le risposte
-
martedì 8 maggio 2012 06:50Moderatore
Hi Ray,
For this problem, we always use execute() to fix it. Have no idea if you have read these two blogs, both of them are useful, but if it not helps, please let me know.
http://blogs.msdn.com/b/jdbcteam/archive/2008/08/04/sqlserverexception-the-statement-did-not-return-a-result-set.aspx
Best Regards,
Iric
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Proposto come risposta Papy NormandModerator martedì 8 maggio 2012 09:51
- Contrassegnato come risposta Iric WenModerator giovedì 10 maggio 2012 08:56

