This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Error in getting data from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error in getting data from database" Watch "Error in getting data from database" New topic
Author

Error in getting data from database

Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 157
i tried to connect to the database using jdbcdbc connection..
while doing so, its giving me this error,

"Error java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt"

Even though, i close my connection properly...





where i'm going wrong..

Thanks...
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

ResultSet rs1 = stm.executeQuery(qry2);
while(rs.next())
You mixed rs1 and rs.


OCUP UML fundamental and ITIL foundation
youtube channel
Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 157
i tried to execute a stored procedures from my code..the stored procedure will process and fill data in a table.
When i tried to execute from my code, its not filling any data in the table. but i try
to execute manually its filling data in the table for same set of input...whether my code is correct or am i making mistake else where... Neither i'm not getting any error..



Thank you
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

Hi,

Is the first issue solved?

Regards, Jan
Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 157
Yes, I solved it.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Where do you commit your transaction?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Neeba Rebbaca
Ranch Hand

Joined: Oct 21, 2008
Posts: 157
In sql server there is an auto commit,rite..still added commit...but the result remains the same.Its not filling data in the table.


thank you..
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


In sql server there is an auto commit,rite

You can enable auto commit. Its not on by default, and personally I would not use it.

Have you tried calling executeUpdate in stead of executeQuery? It seems the more appropriate method.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error in getting data from database