• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

This would be my first time using JDBC within an application. The problem i am having now is the exception that is in the subject line.

Don't get me wrong now, I understand what it means, but i'm not sure what i am doing wrong.
So the database im querying is a little bit strange(at least i think i have yet to see any other database than this one).
Essentially i start off with one value, and must match that to a value in another table, to which i must take another value(being text or date) and compare that to another table. So, in this giant mess of connections and statements i get this error. I ended up creating a new connection for each separate query, but im concerned because i call another query(with a different Connection) before i finish my first query if that is screwing things up.

I am sorry if this does not make the most amount of sense, i am trying my hardest to make it clear.
I could post some code, but I would be a little embarrassed as i am sure that the JDBC handling seems infantile because this is not something that they teach us in school. I have a slight google-education in the matter right now.

I appreciate your help and suggestions in advance, if there is anything that i can clear up, please just let me know.
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joe,

I suppose you are executing queries while iterating in one result set. Can your sql statements and conditions be joined into one sql statement?
Opening a new connection will resolve your problems I guess. But i am pretty sure that some sql improvements can be done.

And there is nothing to be embarrassed or be sorry of since we are here to learn and share.

Regards,
Fatih.
 
Joe Meany
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes that is exactly what i meant, in a much more elegant way

And I'm sure there are improvements to be made, but as a last ditch effort to fix my own problem i did open up a new connection for each of my result sets(i think it turns out to be 7 of them . And i still get the exception after doing that.

That is what really confuses me the most about this i guess.

And I am getting a result set sorting through it and if a condition is met, calling another method where there is more sorting of new result sets and another condition that again, if true, calls a third method that does the same except prints a date as opposed to call a method. If you think it would help the situation i can post the snippet of code in which i am having the problem, but i think ill clean it up a bit before i do that, just let me know if that would help at all.

Thanks very much for your quick reply!
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Connection is busy with results for another hstmt hit the google and found, this happens because an ODBC connection can only have one active cursor at a time.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic