Best Practices for JDBC
Help reduce poor application performance or poor scalability using JDBC best practices.
Use the following JDBC connection properties to improve application performance:
closeHandlesOnFinalize/closeHandlesByCleaner
-
Installs finalizers (JVM 8) or cleaners (JVM 9 and later) for each java.sql.Connection/Statement/ResultSet object, ensuring that the driver automatically sends a close request to the server if the application failed to do so before the object is garbage collected.
-
The default is TRUE, which prevents JDBC applications from leaving connections, statements, and result sets open indefinitely on the server.
-
Not required for programs that ensure java.sql.Connection/Statement/ResultSet.close() is invoked before the object is no longer reachable by any live threads.
-
Setting to FALSE can significantly increase the performance of the JVM, especially under JVM 8, where finalizers are costly in terms of memory (much more so than cleaners under JVM 9 and later).
transactionalLobs
-
Simulates LOB behavior as required by the JDBC specification by postponing the closing of statements and result sets that return CLOBs, NCLOBs, or BLOBs until the end of the current transaction.
-
The default is TRUE, which allows an application to access a java.sql.Clob/NClob/Blob object from a closed prepared statement or closed result set within the current transaction.
-
Required for some code generation frameworks which follow the specification strictly.
-
Setting to FALSE can reduce the number of open statements and result sets on the server, reducing server memory requirements. Setting to FALSE can also decrease JVM memory requirements, reducing the frequency with which the garbage collector must run.
timeZonePerObject
-
Instantiates a new java.util.TimeZone object for each prepared statement and result set for use in time-zone conversions.
-
The default is TRUE, which allows the driver to react to time zone changes (such as when switching to and from daylight savings time) while the JVM is running.
-
Rarely required (the ESRI test suite requires it).
-
Setting to FALSE can significantly reduce the number of object instantiations in the JVM, reducing the frequency with which the garbage collector must run.