Class DataSource

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String[] ALL_PROPERTIES
      Array of all properties recognized and accepted by this datasource.
      static long DEFAULT_INITIALSIZE
      (long) Sets default for initial number of connections established during datasource initialization to 10.
      static int DEFAULT_MAXSTATEMENTS
      (int) Sets default for the global maximum limit of statements per datasource to 0, which means no limit will be enforced.
      static int DEFAULT_MAXSTATEMENTSPERCONNECTION
      (int) Sets default for per-connection maximum of prepared and callable statements to 0.
      static String DEFAULT_URL
      (String) The connection url jdbc:com.nuodb://localhost:48004
      static String DRIVER_CLASS_NAME  
      static String DRIVER_URL_PREFIX  
      static String HIBERNATE_DRIVER_CLASS_NAME  
      static String HIBERNATE_DRIVER_URL_PREFIX  
      static String PROP_DEFAULTAUTOCOMMIT
      (boolean) The default auto-commit state of connections created by this pool.
      static String PROP_DEFAULTREADONLY
      (boolean) The default read-only state of connections created by this pool.
      static String PROP_IDLEVALIDATIONINTERVAL
      (int) The number of milliseconds to sleep between runs of the idle connection validation/cleaner thread.
      static String PROP_INITIALSIZE
      (int) The initial number of connections that are created when the pool is started.
      static String PROP_MAXACTIVE
      (int) The maximum number of active connections that can be allocated from this pool at the same time.
      static String PROP_MAXAGE
      (long) Time in milliseconds to keep this connection.
      static String PROP_MAXIDLE
      (int) The maximum number of connections that should be kept in the pool at all times.
      static String PROP_MAXSTATEMENTS
      (int) The size of global statement cache, if 0 there is not limit.
      static String PROP_MAXSTATEMENTSPERCONNECTION
      (int) The number of statements cached for a single pooled connection.
      static String PROP_MAXWAIT
      (int) The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.
      static String PROP_MINIDLE
      (int) The minimum number of established connections that should be kept in the pool at all times.
      static String PROP_PASSWORD
      (String) The connection password to be passed to the JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
      static String PROP_SCHEMA
      (String) The default schema of connections created by this pool.
      static String PROP_SQL_ENGINE
      (String) The SQL engine used in the connections created by this pool.
      static String PROP_TESTONBORROW
      (boolean) The indication of whether objects will be validated before being borrowed from the pool.
      static String PROP_TESTONRETURN
      (boolean) The indication of whether objects will be validated before being returned to the pool.
      static String PROP_TESTWHILEIDLE
      (boolean) The indication of whether objects will be validated by the idle object evictor.
      static String PROP_URL
      The URL of the NuoDB broker, optionally containing multiple brokers jdbc:com.nuodb://{broker}:{port}, {broker}:{port}, .../{database}, that will be contacted in case the primary one is unreachable
      static String PROP_URLDELIMITER
      (String) The delimiter used to separate the URLs of the brokers in the value of the url property.
      static String PROP_USER
      (String) The connection username to be passed to our JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
      static String PROP_USERNAME
      (String) The connection username to be passed to our JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
      static String PROP_VALIDATIONINTERVAL
      (long) To avoid excess validation, only run validation at most at this frequency - time in milliseconds.
      static String PROP_VALIDATIONQUERY
      (String) The SQL query that will be used to validate connections from this pool before returning them to the caller.
    • Constructor Summary

      Constructors 
      Constructor Description
      DataSource()
      Creates a new data source, initialized from the default properties The connection and statement pool are configured but the initial connections are started when getConnection() is called.
      DataSource​(Properties info)
      Creates a new data source, initialized from the provided properties And starts a connection and statement pool.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      static boolean connectionsAreIdentical​(Connection lhs, Connection rhs)
      Checks whether two connection proxies point to the same connection in the pool
      com.nuodb.jdbc.DataSource.ConnectionHelper createConnectionHelper​(com.nuodb.jdbc.ConnectionKey connectionKey)  
      Connection getConnection()
      Returns connection proxy using the default user and password specified in the initialization properties.
      Connection getConnection​(String user, String password)
      Returns connection proxy created using provided user and password.
      int getLoginTimeout()
      Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
      PrintWriter getLogWriter()
      Retrieves the log writer for this DataSource object used by the StandardLogger.
      Logger getParentLogger()
      Gets the parent logger of all the loggers used by this data source.
      long getPoolActiveConnectionSize()
      Get the number of active connections in the pool
      PooledConnection getPooledConnection()
      Establishes a physical database connection that can be used as a pooled connection using the default user and password specified in the initialization properties.
      PooledConnection getPooledConnection​(String user, String password)
      Establishes a physical database connection that can be used as a pooled connection.
      long getPoolIdleConnectionSize()
      Get the number of idle connections in the pool
      boolean isWrapperFor​(Class<?> type)  
      void setDefaultAutoCommit​(Boolean defaultAutoCommit)
      Sets the default auto-commit state of connections created by this pool.
      void setDefaultReadOnly​(Boolean defaultReadOnly)
      Sets the default read-only state of connections created by this pool.
      void setDefaultSchema​(String schema)
      Sets the default schema of connections created by this pool.
      void setInitialSize​(long initialSize)
      Sets the initial number of connections that are created when the pool is started.
      void setLoginTimeout​(int loginTimeout)
      Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
      void setLogWriter​(PrintWriter logWriter)
      Sets the log writer of the standard logger for DataSource object to the given java.io.PrintWriter object.
      void setMaxActive​(long maxActive)
      Sets the maximum number of active connections that can be allocated from this pool at the same time.
      void setMaxAge​(long maxAge)
      Sets the time in milliseconds to keep this connection.
      void setMaxIdle​(long maxIdle)
      Sets the maximum number of connections that should be kept in the pool at all times.
      void setMaxStatementsPerConnection​(long maxStatementsPerConnection)
      Sets the number of statements cached for a single pooled connection.
      void setMaxWait​(long maxWait)
      Sets the maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.
      void setMinIdle​(long minIdle)
      Sets the minimum number of established connections that should be kept in the pool at all times.
      void setPassword​(String password)
      Sets the connection password to be passed to the JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
      void setProperties​(Properties info)  
      void setSchema​(String schema)
      Sets the default schema of connections created by this pool.
      void setSQLEngine​(String engine)
      Sets the SQL engine of connections created by this pool.
      void setTestOnBorrow​(boolean testOnBorrow)
      Sets the indication of whether objects will be validated before being borrowed from the pool.
      void setTestOnReturn​(boolean testOnReturn)
      Sets the indication of whether objects will be validated before being returned to the pool.
      void setTestWhileIdle​(boolean testWhileIdle)
      Sets the indication of whether objects will be validated by the idle object evictor.
      void setTimeBetweenEvictionRunsMillis​(long timeBetweenEvictionRunsMillis)
      Sets the number of milliseconds to sleep between runs of the idle connection validation/cleaner thread.
      void setUrl​(String url)
      Sets the URL of the NuoDB broker, optionally containing multiple brokers jdbc:com.nuodb://{broker}:{port}, {broker}:{port}, .../{database}, that will be contacted in case the primary one is unreachable This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
      void setUrlDelimiter​(String urlDelimiter)
      Sets the delimiter used to separate the URLs of the brokers in the value of the url property.
      void setUser​(String user)
      Sets the connection username to be passed to our JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
      void setUsername​(String username)
      Sets the username to be passed to the JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
      void setValidationInterval​(long validationInterval)
      Sets the validation interval.
      void setValidationQuery​(String validationQuery)
      Sets the SQL query that will be used to validate connections from this pool before returning them to the caller.
      String toString()
      Returns the current configuration (except password) of the data source as a string.
      <T> T unwrap​(Class<T> type)  
    • Field Detail

      • PROP_URL

        public static final String PROP_URL
        The URL of the NuoDB broker, optionally containing multiple brokers jdbc:com.nuodb://{broker}:{port}, {broker}:{port}, .../{database}, that will be contacted in case the primary one is unreachable
        See Also:
        Constant Field Values
      • PROP_USERNAME

        public static final String PROP_USERNAME
        (String) The connection username to be passed to our JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
        See Also:
        Constant Field Values
      • PROP_USER

        public static final String PROP_USER
        (String) The connection username to be passed to our JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
        See Also:
        Constant Field Values
      • PROP_PASSWORD

        public static final String PROP_PASSWORD
        (String) The connection password to be passed to the JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used.
        See Also:
        Constant Field Values
      • PROP_SCHEMA

        public static final String PROP_SCHEMA
        (String) The default schema of connections created by this pool.
        See Also:
        Constant Field Values
      • PROP_SQL_ENGINE

        public static final String PROP_SQL_ENGINE
        (String) The SQL engine used in the connections created by this pool.
        See Also:
        Constant Field Values
      • PROP_MAXACTIVE

        public static final String PROP_MAXACTIVE
        (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100; if set to 0, there is no limit
        See Also:
        Constant Field Values
      • PROP_MAXIDLE

        public static final String PROP_MAXIDLE
        (int) The maximum number of connections that should be kept in the pool at all times. Default value is the minimum between PROP_MAXACTIVE and 100.
        See Also:
        Constant Field Values
      • PROP_MINIDLE

        public static final String PROP_MINIDLE
        (int) The minimum number of established connections that should be kept in the pool at all times. Default value is the minimum between from PROP_INITIALSIZE and 10
        See Also:
        Constant Field Values
      • PROP_INITIALSIZE

        public static final String PROP_INITIALSIZE
        (int) The initial number of connections that are created when the pool is started. Default value is 10
        See Also:
        Constant Field Values
      • PROP_MAXWAIT

        public static final String PROP_MAXWAIT
        (int) The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception. Default value is 30000 (30 seconds)
        See Also:
        Constant Field Values
      • PROP_MAXAGE

        public static final String PROP_MAXAGE
        (long) Time in milliseconds to keep this connection. When a connection is returned to the pool, the pool will check to see if the now - time-when-connected has reached PROP_MAXAGE, and if so, it closes the connection rather than returning it to the pool. The default value is 300000 (5 minutes). Setting it to 0 means that connections will be left open and no age check will be done.
        See Also:
        Constant Field Values
      • PROP_DEFAULTREADONLY

        public static final String PROP_DEFAULTREADONLY
        (boolean) The default read-only state of connections created by this pool. If not set then the setReadOnly method will not be called.
        See Also:
        Constant Field Values
      • PROP_DEFAULTAUTOCOMMIT

        public static final String PROP_DEFAULTAUTOCOMMIT
        (boolean) The default auto-commit state of connections created by this pool. If not set, default is JDBC driver default (If not set then the setAutoCommit method will not be called.)
        See Also:
        Constant Field Values
      • PROP_TESTONRETURN

        public static final String PROP_TESTONRETURN
        (boolean) The indication of whether objects will be validated before being returned to the pool. NOTE - for a true value to have any effect, the PROP_VALIDATIONQUERY parameter must be set to a non-null string. The default value is false.
        See Also:
        Constant Field Values
      • PROP_TESTONBORROW

        public static final String PROP_TESTONBORROW
        (boolean) The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. NOTE - for a true value to have any effect, the PROP_VALIDATIONQUERY parameter must be set to a non-null string. Default value is false. In order to have a more efficient validation, see PROP_VALIDATIONINTERVAL
        See Also:
        Constant Field Values
      • PROP_TESTWHILEIDLE

        public static final String PROP_TESTWHILEIDLE
        (boolean) The indication of whether objects will be validated by the idle object evictor. If an object fails to validate, it will be dropped from the pool. NOTE - for a true value to have any effect, the PROP_VALIDATIONQUERY parameter must be set to a non-null string. The default value is false.In order to have a more efficient validation, see PROP_VALIDATIONINTERVAL
        See Also:
        Constant Field Values
      • PROP_VALIDATIONQUERY

        public static final String PROP_VALIDATIONQUERY
        (String) The SQL query that will be used to validate connections from this pool before returning them to the caller. If specified, this query does not have to return any data, it just can't throw a SQLException. The default value is null. Example value is SELECT 1 FROM DUAL
        See Also:
        Constant Field Values
      • PROP_VALIDATIONINTERVAL

        public static final String PROP_VALIDATIONINTERVAL
        (long) To avoid excess validation, only run validation at most at this frequency - time in milliseconds. If a connection is due for validation, but has been validated previously within this interval, it will not be validated again. The default value is 30000 (30 seconds).
        See Also:
        Constant Field Values
      • PROP_IDLEVALIDATIONINTERVAL

        public static final String PROP_IDLEVALIDATIONINTERVAL
        (int) The number of milliseconds to sleep between runs of the idle connection validation/cleaner thread. This value should not be set under 1 second. It dictates how often we check for idle, abandoned connections, and how often we validate idle connections. The default value is 5000 (5 seconds).
        See Also:
        Constant Field Values
      • PROP_MAXSTATEMENTS

        public static final String PROP_MAXSTATEMENTS
        (int) The size of global statement cache, if 0 there is not limit.
        See Also:
        Constant Field Values
      • PROP_MAXSTATEMENTSPERCONNECTION

        public static final String PROP_MAXSTATEMENTSPERCONNECTION
        (int) The number of statements cached for a single pooled connection. If the property is non-zero, statement caching will be enabled and maxStatements = 0 global limit will not be enforced, only the per-connection maximum.
        See Also:
        Constant Field Values
      • PROP_URLDELIMITER

        public static final String PROP_URLDELIMITER
        (String) The delimiter used to separate the URLs of the brokers in the value of the url property.
        See Also:
        Constant Field Values
      • DEFAULT_URL

        public static final String DEFAULT_URL
        (String) The connection url jdbc:com.nuodb://localhost:48004
        See Also:
        Constant Field Values
      • DEFAULT_MAXSTATEMENTS

        public static final int DEFAULT_MAXSTATEMENTS
        (int) Sets default for the global maximum limit of statements per datasource to 0, which means no limit will be enforced.
        See Also:
        Constant Field Values
      • DEFAULT_MAXSTATEMENTSPERCONNECTION

        public static final int DEFAULT_MAXSTATEMENTSPERCONNECTION
        (int) Sets default for per-connection maximum of prepared and callable statements to 0.
        See Also:
        Constant Field Values
      • DEFAULT_INITIALSIZE

        public static final long DEFAULT_INITIALSIZE
        (long) Sets default for initial number of connections established during datasource initialization to 10.
        See Also:
        Constant Field Values
      • ALL_PROPERTIES

        public static final String[] ALL_PROPERTIES
        Array of all properties recognized and accepted by this datasource.
    • Constructor Detail

      • DataSource

        public DataSource()
        Creates a new data source, initialized from the default properties The connection and statement pool are configured but the initial connections are started when getConnection() is called.
      • DataSource

        public DataSource​(Properties info)
        Creates a new data source, initialized from the provided properties And starts a connection and statement pool.
        Parameters:
        info - the properties to use as initialization values
    • Method Detail

      • setProperties

        public void setProperties​(Properties info)
      • setLogWriter

        public void setLogWriter​(PrintWriter logWriter)
        Sets the log writer of the standard logger for DataSource object to the given java.io.PrintWriter object. The standard logger can also be set through the initialization property standardLogger.logWriter as string file name or print writer object.
        Specified by:
        setLogWriter in interface CommonDataSource
        Specified by:
        setLogWriter in interface ConnectionPoolDataSource
        Specified by:
        setLogWriter in interface DataSource
        Parameters:
        logWriter - the new log writer; to disable logging, set to null
      • getConnection

        public Connection getConnection()
                                 throws SQLException
        Returns connection proxy using the default user and password specified in the initialization properties. Calling connection.close() on the proxy will return connection to the connection pool.
        Specified by:
        getConnection in interface DataSource
        Returns:
        a connection to the data source
        Throws:
        SQLException - if a database access error occurs
      • getConnection

        public Connection getConnection​(String user,
                                        String password)
                                 throws SQLException
        Returns connection proxy created using provided user and password. Calling connection.close() on the proxy will return connection to the connection pool.
        Specified by:
        getConnection in interface DataSource
        Parameters:
        user - the database user on whose behalf the connection is being made
        password - the user's password
        Returns:
        a connection to the data source
        Throws:
        SQLException - if a database access error occurs
      • createConnectionHelper

        public com.nuodb.jdbc.DataSource.ConnectionHelper createConnectionHelper​(com.nuodb.jdbc.ConnectionKey connectionKey)
      • getPooledConnection

        public PooledConnection getPooledConnection()
                                             throws SQLException
        Establishes a physical database connection that can be used as a pooled connection using the default user and password specified in the initialization properties.
        Specified by:
        getPooledConnection in interface ConnectionPoolDataSource
        Returns:
        object that is a physical connection to the database
        Throws:
        SQLException - if a database access error occurs
      • getPooledConnection

        public PooledConnection getPooledConnection​(String user,
                                                    String password)
                                             throws SQLException
        Establishes a physical database connection that can be used as a pooled connection.
        Specified by:
        getPooledConnection in interface ConnectionPoolDataSource
        Parameters:
        user - the database user on whose behalf the connection is being made
        password - the user's password
        Returns:
        object that is a physical connection to the database
        Throws:
        SQLException - if a database access error occurs
      • connectionsAreIdentical

        public static boolean connectionsAreIdentical​(Connection lhs,
                                                      Connection rhs)
        Checks whether two connection proxies point to the same connection in the pool
        Parameters:
        lhs - object one
        rhs - object two
        Returns:
        true if the objects are identical
      • getPoolIdleConnectionSize

        public long getPoolIdleConnectionSize()
        Get the number of idle connections in the pool
        Returns:
        the number of idle connections in the pool
      • getPoolActiveConnectionSize

        public long getPoolActiveConnectionSize()
        Get the number of active connections in the pool
        Returns:
        the number of active connections in the pool
      • setUrl

        public void setUrl​(String url)
        Sets the URL of the NuoDB broker, optionally containing multiple brokers jdbc:com.nuodb://{broker}:{port}, {broker}:{port}, .../{database}, that will be contacted in case the primary one is unreachable This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        url - The connection url.
      • setUrlDelimiter

        public void setUrlDelimiter​(String urlDelimiter)
        Sets the delimiter used to separate the URLs of the brokers in the value of the url property. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        urlDelimiter - the character used to separate URL of brokers in the connection url.
      • setUser

        public void setUser​(String user)
        Sets the connection username to be passed to our JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        user - The connection username.
      • setUsername

        public void setUsername​(String username)
        Sets the username to be passed to the JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        username - The connection username.
      • setPassword

        public void setPassword​(String password)
        Sets the connection password to be passed to the JDBC driver to establish a connection, unless DataSource.getConnection(username, password) is used. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        password - The connection password.
      • setSchema

        public void setSchema​(String schema)
        Sets the default schema of connections created by this pool. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        schema - The default schema for connections in this pool.
      • setDefaultSchema

        public void setDefaultSchema​(String schema)
        Sets the default schema of connections created by this pool. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        schema - The default schema for connections in this pool.
      • setSQLEngine

        public void setSQLEngine​(String engine)
        Sets the SQL engine of connections created by this pool. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        password - The connection password.
      • setDefaultReadOnly

        public void setDefaultReadOnly​(Boolean defaultReadOnly)
        Sets the default read-only state of connections created by this pool. If not set then the setReadOnly method will not be called. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        defaultReadOnly - The default read-only state of connections created by this pool.
      • setDefaultAutoCommit

        public void setDefaultAutoCommit​(Boolean defaultAutoCommit)
        Sets the default auto-commit state of connections created by this pool. If not set, default is JDBC driver default (If not set then the setAutoCommit method will not be called.) This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        defaultAutoCommit - The default auto-commit state of connections created by this pool.
      • setInitialSize

        public void setInitialSize​(long initialSize)
        Sets the initial number of connections that are created when the pool is started. Default value is 10 This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        initialSize - The initial number of connections that are created when the pool is started.
      • setMaxActive

        public void setMaxActive​(long maxActive)
        Sets the maximum number of active connections that can be allocated from this pool at the same time. The default value is 100; if set to 0, there is no limit This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        maxActive - The maximum number of active connections that can be allocated from this pool at the same time.
      • setMaxIdle

        public void setMaxIdle​(long maxIdle)
        Sets the maximum number of connections that should be kept in the pool at all times. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        maxIdle - The maximum number of connections that should be kept in the pool at all times.
      • setMinIdle

        public void setMinIdle​(long minIdle)
        Sets the minimum number of established connections that should be kept in the pool at all times. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        minIdle - The minimum number of established connections that should be kept in the pool at all times.
      • setMaxWait

        public void setMaxWait​(long maxWait)
        Sets the maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        maxWait - The value of maxWait in milliseconds.
      • setMaxAge

        public void setMaxAge​(long maxAge)
        Sets the time in milliseconds to keep this connection. When a connection is returned to the pool, the pool will check to see if the now - time-when-connected has reached PROP_MAXAGE, and if so, it closes the connection rather than returning it to the pool. The default value is 300000 (5 minutes). Setting it to 0 means that connections will be left open and no age check will be done. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        maxAge - The value of maxAge in milliseconds.
      • setMaxStatementsPerConnection

        public void setMaxStatementsPerConnection​(long maxStatementsPerConnection)
        Sets the number of statements cached for a single pooled connection. If the property is non-zero, statement caching will be enabled and maxStatements = 0 global limit will not be enforced, only the per-connection maximum. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        maxStatementsPerConnection - The number of statements cached for a single pooled connection.
      • setTestOnReturn

        public void setTestOnReturn​(boolean testOnReturn)
        Sets the indication of whether objects will be validated before being returned to the pool. NOTE - for a true value to have any effect, the PROP_VALIDATIONQUERY parameter must be set to a non-null string. The default value is false. This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        testOnReturn - The indication of whether objects will be validated before being returned to the pool.
      • setTestOnBorrow

        public void setTestOnBorrow​(boolean testOnBorrow)
        Sets the indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. NOTE - for a true value to have any effect, the PROP_VALIDATIONQUERY parameter must be set to a non-null string. Default value is false. In order to have a more efficient validation, see PROP_VALIDATIONINTERVAL This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        testOnBorrow - The indication of whether objects will be validated before being borrowed from the pool.
      • setTestWhileIdle

        public void setTestWhileIdle​(boolean testWhileIdle)
        Sets the indication of whether objects will be validated by the idle object evictor. If an object fails to validate, it will be dropped from the pool. NOTE - for a true value to have any effect, the PROP_VALIDATIONQUERY parameter must be set to a non-null string. The default value is false.In order to have a more efficient validation, see PROP_VALIDATIONINTERVAL This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        testWhileIdle - The indication of whether objects will be validated by the idle object evictor.
      • setValidationQuery

        public void setValidationQuery​(String validationQuery)
        Sets the SQL query that will be used to validate connections from this pool before returning them to the caller. If specified, this query does not have to return any data, it just can't throw a SQLException. The default value is null. Example value is SELECT 1 FROM DUAL This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        validationQuery - The SQL query that will be used to validate connections.
      • setValidationInterval

        public void setValidationInterval​(long validationInterval)
        Sets the validation interval. To avoid excess validation, only run validation at most at this frequency - time in milliseconds. If a connection is due for validation, but has been validated previously within this interval, it will not be validated again. The default value is 30000 (30 seconds). This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        validationInterval - The validation interval in milliseconds.
      • setTimeBetweenEvictionRunsMillis

        public void setTimeBetweenEvictionRunsMillis​(long timeBetweenEvictionRunsMillis)
        Sets the number of milliseconds to sleep between runs of the idle connection validation/cleaner thread. This value should not be set under 1 second. It dictates how often we check for idle, abandoned connections, and how often we validate idle connections. The default value is 5000 (5 seconds). This method cannot be used used once the data source is initialized (i.e; at least one connection in the pool has been made successfully.)
        Parameters:
        timeBetweenEvictionRunsMillis - The number of milliseconds to sleep between runs of the idle connection validation/cleaner thread.
      • toString

        public String toString()
        Returns the current configuration (except password) of the data source as a string.
        Overrides:
        toString in class Object