JDBC objects can be safely held in local variables, object instance and class members. In Java 7, Oracle has introduced the AutoCloseable interface which replaces most of the Java 6 boilerplate with some nice syntactic sugar. If you have a loop over, for example, creating and executing Statements, remember to close each Statement within the loop. We want to allow any exception raised in the body of the try to propagate to the caller., it might fail and prevent the Statement being closed Is it advisable to use instance variable statement/resultset object instead of method local statement/resultset object in a single threaded environment ?ĭoes executing a prepared statement in a loop cause this issue ? (Of course, I could have used sqlBatch) Note: pStmt is closed once loop is over.Is there a way to configure the number of statement/resultset objects in the database (like connections) ?.Are maximum open cursors exactly related to number of JDBC connections, or are they also related to the statement and resultset objects we have created for a single connection ? (We are using pool of connections).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |