This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.
Joined: Jun 14, 2011
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.