Class JDBCConnectionFactory

  • All Implemented Interfaces:
    org.apache.commons.pool2.PooledObjectFactory<java.sql.Connection>
    Direct Known Subclasses:
    ConnectionErrorCheckingJDBCConnectionFactory

    public class JDBCConnectionFactory
    extends java.lang.Object
    implements org.apache.commons.pool2.PooledObjectFactory<java.sql.Connection>
    • Constructor Detail

      • JDBCConnectionFactory

        public JDBCConnectionFactory​(HybrisDataSource dateSource)
    • Method Detail

      • resetStats

        public void resetStats()
      • getNumPhysicalOpen

        public int getNumPhysicalOpen()
      • getMaxPhysicalOpen

        public int getMaxPhysicalOpen()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • makeObject

        public org.apache.commons.pool2.PooledObject<java.sql.Connection> makeObject()
                                                                              throws java.sql.SQLException
        Specified by:
        makeObject in interface org.apache.commons.pool2.PooledObjectFactory<java.sql.Connection>
        Throws:
        java.sql.SQLException
      • createRawSQLConnection

        protected java.sql.Connection createRawSQLConnection()
                                                      throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • activateObject

        public void activateObject​(org.apache.commons.pool2.PooledObject<java.sql.Connection> pooledConnection)
        Specified by:
        activateObject in interface org.apache.commons.pool2.PooledObjectFactory<java.sql.Connection>
      • passivateObject

        public void passivateObject​(org.apache.commons.pool2.PooledObject<java.sql.Connection> pooledConnection)
        Specified by:
        passivateObject in interface org.apache.commons.pool2.PooledObjectFactory<java.sql.Connection>
      • destroyObject

        public void destroyObject​(org.apache.commons.pool2.PooledObject<java.sql.Connection> pooledConnection)
                           throws java.sql.SQLException
        Specified by:
        destroyObject in interface org.apache.commons.pool2.PooledObjectFactory<java.sql.Connection>
        Throws:
        java.sql.SQLException
      • mustValidate

        protected boolean mustValidate​(java.lang.Object obj)
      • getValidationQuery

        protected java.lang.String getValidationQuery()
      • validateObject

        public boolean validateObject​(org.apache.commons.pool2.PooledObject<java.sql.Connection> pooledConnection)
        Specified by:
        validateObject in interface org.apache.commons.pool2.PooledObjectFactory<java.sql.Connection>
      • enableOracleStatementCaching

        public void enableOracleStatementCaching​(int cacheSize)
        Explicitly enables oracle statement caching no matter what settings have been put into configuration.
        Parameters:
        cacheSize - the statement cache size
      • resetOracleStatementCaching

        public void resetOracleStatementCaching()
        Resets oracle statements caching state. The next time a connection is being fetched these settings are reloaded from configuration.
      • disableOracleStatementCaching

        public void disableOracleStatementCaching()
        Explicitly switches off oracle statement caching. This is particular helpful if database schema changes are likely to happen afterwards.

        For re-enabling statement caching call either enableOracleStatementCaching(int) or resetOracleStatementCaching().

      • isOracleStatementCachingEnabled

        public boolean isOracleStatementCachingEnabled()
        Tells if oracle (implicit) statement caching is currently enabled.