P
Pablo
Hi all,
Let's say I have the following code:
try {
PreparedStatement insInvoice = conn.prepareStatement( "INSERT INTO
....");
insInvoice.executeUpdate();
conn.commit();
insInvoice.close();
conn.close();
}
catch(SQLException ex)
{
//...
}
I just would like to know the following: If I have an exception before
the "close()" method calls, is it going to leave the connection opened?
I could put the "close()" calls in a "finally" block, but I would have
to, again make another try-catch block somewhere (either inside the
finally or in the caller method).
What is the best approach?
Regards,
P.
Let's say I have the following code:
try {
PreparedStatement insInvoice = conn.prepareStatement( "INSERT INTO
....");
insInvoice.executeUpdate();
conn.commit();
insInvoice.close();
conn.close();
}
catch(SQLException ex)
{
//...
}
I just would like to know the following: If I have an exception before
the "close()" method calls, is it going to leave the connection opened?
I could put the "close()" calls in a "finally" block, but I would have
to, again make another try-catch block somewhere (either inside the
finally or in the caller method).
What is the best approach?
Regards,
P.