aspose file tools*
The moose likes JDBC and the fly likes A question regarding Connection object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "A question regarding Connection object" Watch "A question regarding Connection object" New topic
Author

A question regarding Connection object

Nila dhan
Ranch Hand

Joined: Sep 15, 2005
Posts: 161
What will happen to the connection object if an exception occurs while excecuting a prepared statement.For example,


what will happen to the connection object if an exception is thrown while executing the query?
Thanks in advance
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
In general, the Connection object would remain able to perform further operations. That certainly ought to be the case if the exception was due to bad SQL syntax, missing data etc. If, on the other hand, the exception was due to a lost physical link to the database, the Connection would be broken.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Nila dhan
Ranch Hand

Joined: Sep 15, 2005
Posts: 161
There are a number of rows that are inserted iteratively and for each row, a Statement is prepared from connection.After insertion of a certain number of records, I get a stament has been already closed exception.
What could be the reason for this?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: A question regarding Connection object