Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Exception Connection is busy with results for another hstmt.

 
Prem Bhazee
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers

I am running a Java application which has multiple sql queries including update and insert.Basically I am connecting to a MS Sql Server.


But I am getting the following error.

Error Details - [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt.

I am getting this error only when my Jave application is accessing the database to do this update/insert. At the same time when
another application is updating the same database.

Please let me know if I need to post my piece of code which has the JDBC operations or this error is due to the database contention when two apps working on the same table.

Can you please let me know a work around for this kind of sql exception.


Thanks in advance
Bhazee
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prem,
Are you using different connection objects for the concurrent queries?
 
Prem Bhazee
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,
I am using different connection objects for the concurrent queries and I am also closing both the connection objects.

Bhazee
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can your share your snippet of code (which has JDBC Operation).
 
Prem Bhazee
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
First of all thanks for your time. Here is the JDBC snippet.


Please let me know if you need more details.
Thanks
Bhazee
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to commit your first connection object before creating another one.

think it works. (not sure)
 
Prem Bhazee
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
But I need to commit only when all the queries are executed successfully or else rollback both.

Thanks
Bhazee
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what if? if you use the same connection Object for this transaction.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prem Bhazee:
Yes,
I am using different connection objects for the concurrent queries and I am also closing both the connection objects.

Bhazee


Are you sure?
You call getConnection(), but where do you check that it returns two different instances?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic