Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Oracle JDBC driver's limitations
I read the book and manual on oracle's jdbc driver, and it SEEMS to suggest
that oracle's driver has some extra limitations. However, the description
is not clear enough so I just want to double check here.
I am using Oracle 9i R2.
In the following code, my understanding is oracle requries the rs.close() and pstmt.close() must be present. Is it true? The online documentation vaguely suggested that because the driver doesnt have a finalizer() so the user must explicitly close ResultSet and Statement. And, I do come across such an example in another Oracle jdbc textbook.
Normally, I would like to put the pstmt=con.prepareStatement(sql); before the for loop and do pstmt.close() in finally block and ignore rs.close() altogether. This should be the standard practice. Is it applicable to Oracle 9iR2?
for (...) {
pstmt=con.prepareStatement(sql); pstmt.setInt(1, someLoopVar); rs=pstmt.executeQuery(); if (rs.next()) { .... } rs.close(); pstmt.close();