Package org.h2.jdbc

Class JdbcConnection

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper, CastDataProvider, JdbcConnectionBackwardsCompat

    public class JdbcConnection
    extends org.h2.message.TraceObject
    implements java.sql.Connection, JdbcConnectionBackwardsCompat, CastDataProvider
    Represents a connection (session) to a database.

    Thread safety: the connection is thread-safe, because access is synchronized. Different statements from the same connection may try to execute their commands in parallel, but they will be executed sequentially. If real concurrent execution of these commands is needed, different connections should be used.

    • Field Summary

      • Fields inherited from class org.h2.message.TraceObject

        ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, SQLXML, STATEMENT, trace, XA_DATA_SOURCE, XID
      • Fields inherited from interface java.sql.Connection

        TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
    • Constructor Summary

      Constructors 
      Constructor Description
      JdbcConnection​(java.lang.String url, java.util.Properties info, java.lang.String user, java.lang.Object password, boolean forbidCreation)
      INTERNAL the session closable object does not leak as Eclipse warns - due to the CloseWatcher.
      JdbcConnection​(Session session, java.lang.String user, java.lang.String url)
      INTERNAL
      JdbcConnection​(JdbcConnection clone)
      INTERNAL
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abort​(java.util.concurrent.Executor executor)
      [Not supported]
      protected void checkClosed()
      INTERNAL.
      void clearWarnings()
      Clears all warnings.
      void close()
      Closes this connection.
      void commit()
      Commits the current transaction.
      java.sql.Array createArrayOf​(java.lang.String typeName, java.lang.Object[] elements)
      Create a new Array object.
      java.sql.Blob createBlob()
      Create a new empty Blob object.
      java.sql.Clob createClob()
      Create a new empty Clob object.
      java.sql.NClob createNClob()
      Create a new empty NClob object.
      java.sql.SQLXML createSQLXML()
      Create a new SQLXML object with no data.
      java.sql.Statement createStatement()
      Creates a new statement.
      java.sql.Statement createStatement​(int resultSetType, int resultSetConcurrency)
      Creates a statement with the specified result set type and concurrency.
      java.sql.Statement createStatement​(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
      Creates a statement with the specified result set type, concurrency, and holdability.
      java.sql.Struct createStruct​(java.lang.String typeName, java.lang.Object[] attributes)
      [Not supported] Create a new empty Struct object.
      org.h2.value.ValueTimestampTimeZone currentTimestamp()
      Returns the current timestamp with maximum resolution.
      org.h2.util.TimeZoneProvider currentTimeZone()
      Returns the current time zone.
      boolean getAutoCommit()
      Gets the current setting for auto commit.
      java.lang.String getCatalog()
      Gets the current catalog name.
      java.util.Properties getClientInfo()
      Get the client properties.
      java.lang.String getClientInfo​(java.lang.String name)
      Get a client property.
      int getHoldability()
      Returns the current result set holdability.
      JavaObjectSerializer getJavaObjectSerializer()
      Returns the custom Java object serializer, or null.
      java.sql.DatabaseMetaData getMetaData()
      Gets the database meta data for this database.
      Mode getMode()
      Returns the database mode.
      int getNetworkTimeout()
      [Not supported]
      java.lang.String getSchema()
      Retrieves this current schema name for this connection.
      Session getSession()
      INTERNAL
      Session.StaticSettings getStaticSettings()
      INTERNAL
      int getTransactionIsolation()
      Returns the current transaction isolation level.
      java.util.Map<java.lang.String,​java.lang.Class<?>> getTypeMap()
      Gets the type map.
      java.sql.SQLWarning getWarnings()
      Gets the first warning reported by calls on this object.
      boolean isClosed()
      Returns true if this connection has been closed.
      boolean isReadOnly()
      Returns true if the database is read-only.
      boolean isValid​(int timeout)
      Returns true if this connection is still valid.
      boolean isWrapperFor​(java.lang.Class<?> iface)
      Checks if unwrap can return an object of this class.
      java.lang.String nativeSQL​(java.lang.String sql)
      Translates a SQL statement into the database grammar.
      java.sql.CallableStatement prepareCall​(java.lang.String sql)
      Creates a new callable statement.
      java.sql.CallableStatement prepareCall​(java.lang.String sql, int resultSetType, int resultSetConcurrency)
      Creates a callable statement with the specified result set type and concurrency.
      java.sql.CallableStatement prepareCall​(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
      Creates a callable statement with the specified result set type, concurrency, and holdability.
      java.sql.PreparedStatement prepareStatement​(java.lang.String sql)
      Creates a new prepared statement.
      java.sql.PreparedStatement prepareStatement​(java.lang.String sql, int autoGeneratedKeys)
      Creates a new prepared statement.
      java.sql.PreparedStatement prepareStatement​(java.lang.String sql, int[] columnIndexes)
      Creates a new prepared statement.
      java.sql.PreparedStatement prepareStatement​(java.lang.String sql, int resultSetType, int resultSetConcurrency)
      Creates a prepared statement with the specified result set type and concurrency.
      java.sql.PreparedStatement prepareStatement​(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
      Creates a prepared statement with the specified result set type, concurrency, and holdability.
      java.sql.PreparedStatement prepareStatement​(java.lang.String sql, java.lang.String[] columnNames)
      Creates a new prepared statement.
      void releaseSavepoint​(java.sql.Savepoint savepoint)
      Releases a savepoint.
      void rollback()
      Rolls back the current transaction.
      void rollback​(java.sql.Savepoint savepoint)
      Rolls back to a savepoint.
      void setAutoCommit​(boolean autoCommit)
      Switches auto commit on or off.
      void setCatalog​(java.lang.String catalog)
      Set the default catalog name.
      void setClientInfo​(java.lang.String name, java.lang.String value)
      Set a client property.
      void setClientInfo​(java.util.Properties properties)
      Set the client properties.
      void setHoldability​(int holdability)
      Changes the current result set holdability.
      void setNetworkTimeout​(java.util.concurrent.Executor executor, int milliseconds)
      [Not supported]
      void setReadOnly​(boolean readOnly)
      According to the JDBC specs, this setting is only a hint to the database to enable optimizations - it does not cause writes to be prohibited.
      java.sql.Savepoint setSavepoint()
      Creates a new unnamed savepoint.
      java.sql.Savepoint setSavepoint​(java.lang.String name)
      Creates a new named savepoint.
      void setSchema​(java.lang.String schema)
      Sets the given schema name to access.
      void setTransactionIsolation​(int level)
      Changes the current transaction isolation level.
      void setTypeMap​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
      [Partially supported] Sets the type map.
      java.lang.String toString()
      INTERNAL
      <T> T unwrap​(java.lang.Class<T> iface)
      Return an object of this class if possible.
      boolean zeroBasedEnums()
      Returns are ENUM values 0-based.
      • Methods inherited from class org.h2.message.TraceObject

        debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupported
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.sql.Connection

        beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
    • Constructor Detail

      • JdbcConnection

        public JdbcConnection​(java.lang.String url,
                              java.util.Properties info,
                              java.lang.String user,
                              java.lang.Object password,
                              boolean forbidCreation)
                       throws java.sql.SQLException
        INTERNAL the session closable object does not leak as Eclipse warns - due to the CloseWatcher.
        Parameters:
        url - of this connection
        info - of this connection
        user - of this connection
        password - for the user
        forbidCreation - whether database creation is forbidden
        Throws:
        java.sql.SQLException - on failure
      • JdbcConnection

        public JdbcConnection​(JdbcConnection clone)
        INTERNAL
        Parameters:
        clone - connection to clone
      • JdbcConnection

        public JdbcConnection​(Session session,
                              java.lang.String user,
                              java.lang.String url)
        INTERNAL
        Parameters:
        session - of this connection
        user - of this connection
        url - of this connection
    • Method Detail

      • createStatement

        public java.sql.Statement createStatement()
                                           throws java.sql.SQLException
        Creates a new statement.
        Specified by:
        createStatement in interface java.sql.Connection
        Returns:
        the new statement
        Throws:
        java.sql.SQLException - if the connection is closed
      • createStatement

        public java.sql.Statement createStatement​(int resultSetType,
                                                  int resultSetConcurrency)
                                           throws java.sql.SQLException
        Creates a statement with the specified result set type and concurrency.
        Specified by:
        createStatement in interface java.sql.Connection
        Parameters:
        resultSetType - the result set type (ResultSet.TYPE_*)
        resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)
        Returns:
        the statement
        Throws:
        java.sql.SQLException - if the connection is closed or the result set type or concurrency are not supported
      • createStatement

        public java.sql.Statement createStatement​(int resultSetType,
                                                  int resultSetConcurrency,
                                                  int resultSetHoldability)
                                           throws java.sql.SQLException
        Creates a statement with the specified result set type, concurrency, and holdability.
        Specified by:
        createStatement in interface java.sql.Connection
        Parameters:
        resultSetType - the result set type (ResultSet.TYPE_*)
        resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)
        resultSetHoldability - the holdability (ResultSet.HOLD* / CLOSE*)
        Returns:
        the statement
        Throws:
        java.sql.SQLException - if the connection is closed or the result set type, concurrency, or holdability are not supported
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql)
                                                    throws java.sql.SQLException
        Creates a new prepared statement.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        Returns:
        the prepared statement
        Throws:
        java.sql.SQLException - if the connection is closed
      • getMetaData

        public java.sql.DatabaseMetaData getMetaData()
                                              throws java.sql.SQLException
        Gets the database meta data for this database.
        Specified by:
        getMetaData in interface java.sql.Connection
        Returns:
        the database meta data
        Throws:
        java.sql.SQLException - if the connection is closed
      • getSession

        public Session getSession()
        INTERNAL
        Returns:
        session
      • close

        public void close()
                   throws java.sql.SQLException
        Closes this connection. All open statements, prepared statements and result sets that where created by this connection become invalid after calling this method. If there is an uncommitted transaction, it will be rolled back.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • setAutoCommit

        public void setAutoCommit​(boolean autoCommit)
                           throws java.sql.SQLException
        Switches auto commit on or off. Enabling it commits an uncommitted transaction, if there is one.
        Specified by:
        setAutoCommit in interface java.sql.Connection
        Parameters:
        autoCommit - true for auto commit on, false for off
        Throws:
        java.sql.SQLException - if the connection is closed
      • getAutoCommit

        public boolean getAutoCommit()
                              throws java.sql.SQLException
        Gets the current setting for auto commit.
        Specified by:
        getAutoCommit in interface java.sql.Connection
        Returns:
        true for on, false for off
        Throws:
        java.sql.SQLException - if the connection is closed
      • commit

        public void commit()
                    throws java.sql.SQLException
        Commits the current transaction. This call has only an effect if auto commit is switched off.
        Specified by:
        commit in interface java.sql.Connection
        Throws:
        java.sql.SQLException - if the connection is closed
      • rollback

        public void rollback()
                      throws java.sql.SQLException
        Rolls back the current transaction. This call has only an effect if auto commit is switched off.
        Specified by:
        rollback in interface java.sql.Connection
        Throws:
        java.sql.SQLException - if the connection is closed
      • isClosed

        public boolean isClosed()
                         throws java.sql.SQLException
        Returns true if this connection has been closed.
        Specified by:
        isClosed in interface java.sql.Connection
        Returns:
        true if close was called
        Throws:
        java.sql.SQLException
      • nativeSQL

        public java.lang.String nativeSQL​(java.lang.String sql)
                                   throws java.sql.SQLException
        Translates a SQL statement into the database grammar.
        Specified by:
        nativeSQL in interface java.sql.Connection
        Parameters:
        sql - the SQL statement with or without JDBC escape sequences
        Returns:
        the translated statement
        Throws:
        java.sql.SQLException - if the connection is closed
      • setReadOnly

        public void setReadOnly​(boolean readOnly)
                         throws java.sql.SQLException
        According to the JDBC specs, this setting is only a hint to the database to enable optimizations - it does not cause writes to be prohibited.
        Specified by:
        setReadOnly in interface java.sql.Connection
        Parameters:
        readOnly - ignored
        Throws:
        java.sql.SQLException - if the connection is closed
      • isReadOnly

        public boolean isReadOnly()
                           throws java.sql.SQLException
        Returns true if the database is read-only.
        Specified by:
        isReadOnly in interface java.sql.Connection
        Returns:
        if the database is read-only
        Throws:
        java.sql.SQLException - if the connection is closed
      • setCatalog

        public void setCatalog​(java.lang.String catalog)
                        throws java.sql.SQLException
        Set the default catalog name. This call is ignored.
        Specified by:
        setCatalog in interface java.sql.Connection
        Parameters:
        catalog - ignored
        Throws:
        java.sql.SQLException - if the connection is closed
      • getCatalog

        public java.lang.String getCatalog()
                                    throws java.sql.SQLException
        Gets the current catalog name.
        Specified by:
        getCatalog in interface java.sql.Connection
        Returns:
        the catalog name
        Throws:
        java.sql.SQLException - if the connection is closed
      • getWarnings

        public java.sql.SQLWarning getWarnings()
                                        throws java.sql.SQLException
        Gets the first warning reported by calls on this object.
        Specified by:
        getWarnings in interface java.sql.Connection
        Returns:
        null
        Throws:
        java.sql.SQLException
      • clearWarnings

        public void clearWarnings()
                           throws java.sql.SQLException
        Clears all warnings.
        Specified by:
        clearWarnings in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
                                                           int resultSetType,
                                                           int resultSetConcurrency)
                                                    throws java.sql.SQLException
        Creates a prepared statement with the specified result set type and concurrency.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        resultSetType - the result set type (ResultSet.TYPE_*)
        resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)
        Returns:
        the prepared statement
        Throws:
        java.sql.SQLException - if the connection is closed or the result set type or concurrency are not supported
      • setTransactionIsolation

        public void setTransactionIsolation​(int level)
                                     throws java.sql.SQLException
        Changes the current transaction isolation level. Calling this method will commit an open transaction, even if the new level is the same as the old one.
        Specified by:
        setTransactionIsolation in interface java.sql.Connection
        Parameters:
        level - the new transaction isolation level: Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, 6 (SNAPSHOT), or Connection.TRANSACTION_SERIALIZABLE
        Throws:
        java.sql.SQLException - if the connection is closed or the isolation level is not valid
      • getTransactionIsolation

        public int getTransactionIsolation()
                                    throws java.sql.SQLException
        Returns the current transaction isolation level.
        Specified by:
        getTransactionIsolation in interface java.sql.Connection
        Returns:
        the isolation level
        Throws:
        java.sql.SQLException - if the connection is closed
      • setHoldability

        public void setHoldability​(int holdability)
                            throws java.sql.SQLException
        Changes the current result set holdability.
        Specified by:
        setHoldability in interface java.sql.Connection
        Parameters:
        holdability - ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT;
        Throws:
        java.sql.SQLException - if the connection is closed or the holdability is not supported
      • getHoldability

        public int getHoldability()
                           throws java.sql.SQLException
        Returns the current result set holdability.
        Specified by:
        getHoldability in interface java.sql.Connection
        Returns:
        the holdability
        Throws:
        java.sql.SQLException - if the connection is closed
      • getTypeMap

        public java.util.Map<java.lang.String,​java.lang.Class<?>> getTypeMap()
                                                                            throws java.sql.SQLException
        Gets the type map.
        Specified by:
        getTypeMap in interface java.sql.Connection
        Returns:
        null
        Throws:
        java.sql.SQLException - if the connection is closed
      • setTypeMap

        public void setTypeMap​(java.util.Map<java.lang.String,​java.lang.Class<?>> map)
                        throws java.sql.SQLException
        [Partially supported] Sets the type map. This is only supported if the map is empty or null.
        Specified by:
        setTypeMap in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • prepareCall

        public java.sql.CallableStatement prepareCall​(java.lang.String sql)
                                               throws java.sql.SQLException
        Creates a new callable statement.
        Specified by:
        prepareCall in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        Returns:
        the callable statement
        Throws:
        java.sql.SQLException - if the connection is closed or the statement is not valid
      • prepareCall

        public java.sql.CallableStatement prepareCall​(java.lang.String sql,
                                                      int resultSetType,
                                                      int resultSetConcurrency)
                                               throws java.sql.SQLException
        Creates a callable statement with the specified result set type and concurrency.
        Specified by:
        prepareCall in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        resultSetType - the result set type (ResultSet.TYPE_*)
        resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)
        Returns:
        the callable statement
        Throws:
        java.sql.SQLException - if the connection is closed or the result set type or concurrency are not supported
      • prepareCall

        public java.sql.CallableStatement prepareCall​(java.lang.String sql,
                                                      int resultSetType,
                                                      int resultSetConcurrency,
                                                      int resultSetHoldability)
                                               throws java.sql.SQLException
        Creates a callable statement with the specified result set type, concurrency, and holdability.
        Specified by:
        prepareCall in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        resultSetType - the result set type (ResultSet.TYPE_*)
        resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)
        resultSetHoldability - the holdability (ResultSet.HOLD* / CLOSE*)
        Returns:
        the callable statement
        Throws:
        java.sql.SQLException - if the connection is closed or the result set type, concurrency, or holdability are not supported
      • setSavepoint

        public java.sql.Savepoint setSavepoint()
                                        throws java.sql.SQLException
        Creates a new unnamed savepoint.
        Specified by:
        setSavepoint in interface java.sql.Connection
        Returns:
        the new savepoint
        Throws:
        java.sql.SQLException
      • setSavepoint

        public java.sql.Savepoint setSavepoint​(java.lang.String name)
                                        throws java.sql.SQLException
        Creates a new named savepoint.
        Specified by:
        setSavepoint in interface java.sql.Connection
        Parameters:
        name - the savepoint name
        Returns:
        the new savepoint
        Throws:
        java.sql.SQLException
      • rollback

        public void rollback​(java.sql.Savepoint savepoint)
                      throws java.sql.SQLException
        Rolls back to a savepoint.
        Specified by:
        rollback in interface java.sql.Connection
        Parameters:
        savepoint - the savepoint
        Throws:
        java.sql.SQLException
      • releaseSavepoint

        public void releaseSavepoint​(java.sql.Savepoint savepoint)
                              throws java.sql.SQLException
        Releases a savepoint.
        Specified by:
        releaseSavepoint in interface java.sql.Connection
        Parameters:
        savepoint - the savepoint to release
        Throws:
        java.sql.SQLException
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
                                                           int resultSetType,
                                                           int resultSetConcurrency,
                                                           int resultSetHoldability)
                                                    throws java.sql.SQLException
        Creates a prepared statement with the specified result set type, concurrency, and holdability.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        resultSetType - the result set type (ResultSet.TYPE_*)
        resultSetConcurrency - the concurrency (ResultSet.CONCUR_*)
        resultSetHoldability - the holdability (ResultSet.HOLD* / CLOSE*)
        Returns:
        the prepared statement
        Throws:
        java.sql.SQLException - if the connection is closed or the result set type, concurrency, or holdability are not supported
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
                                                           int autoGeneratedKeys)
                                                    throws java.sql.SQLException
        Creates a new prepared statement.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        autoGeneratedKeys - Statement.RETURN_GENERATED_KEYS if generated keys should be available for retrieval, Statement.NO_GENERATED_KEYS if generated keys should not be available
        Returns:
        the prepared statement
        Throws:
        java.sql.SQLException - if the connection is closed
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
                                                           int[] columnIndexes)
                                                    throws java.sql.SQLException
        Creates a new prepared statement.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        columnIndexes - an array of column indexes indicating the columns with generated keys that should be returned from the inserted row
        Returns:
        the prepared statement
        Throws:
        java.sql.SQLException - if the connection is closed
      • prepareStatement

        public java.sql.PreparedStatement prepareStatement​(java.lang.String sql,
                                                           java.lang.String[] columnNames)
                                                    throws java.sql.SQLException
        Creates a new prepared statement.
        Specified by:
        prepareStatement in interface java.sql.Connection
        Parameters:
        sql - the SQL statement
        columnNames - an array of column names indicating the columns with generated keys that should be returned from the inserted row
        Returns:
        the prepared statement
        Throws:
        java.sql.SQLException - if the connection is closed
      • checkClosed

        protected void checkClosed()
        INTERNAL. Check if this connection is closed.
        Throws:
        org.h2.message.DbException - if the connection or session is closed
      • createClob

        public java.sql.Clob createClob()
                                 throws java.sql.SQLException
        Create a new empty Clob object.
        Specified by:
        createClob in interface java.sql.Connection
        Returns:
        the object
        Throws:
        java.sql.SQLException
      • createBlob

        public java.sql.Blob createBlob()
                                 throws java.sql.SQLException
        Create a new empty Blob object.
        Specified by:
        createBlob in interface java.sql.Connection
        Returns:
        the object
        Throws:
        java.sql.SQLException
      • createNClob

        public java.sql.NClob createNClob()
                                   throws java.sql.SQLException
        Create a new empty NClob object.
        Specified by:
        createNClob in interface java.sql.Connection
        Returns:
        the object
        Throws:
        java.sql.SQLException
      • createSQLXML

        public java.sql.SQLXML createSQLXML()
                                     throws java.sql.SQLException
        Create a new SQLXML object with no data.
        Specified by:
        createSQLXML in interface java.sql.Connection
        Returns:
        the object
        Throws:
        java.sql.SQLException
      • createArrayOf

        public java.sql.Array createArrayOf​(java.lang.String typeName,
                                            java.lang.Object[] elements)
                                     throws java.sql.SQLException
        Create a new Array object.
        Specified by:
        createArrayOf in interface java.sql.Connection
        Parameters:
        typeName - the type name
        elements - the values
        Returns:
        the array
        Throws:
        java.sql.SQLException
      • createStruct

        public java.sql.Struct createStruct​(java.lang.String typeName,
                                            java.lang.Object[] attributes)
                                     throws java.sql.SQLException
        [Not supported] Create a new empty Struct object.
        Specified by:
        createStruct in interface java.sql.Connection
        Throws:
        java.sql.SQLException
      • isValid

        public boolean isValid​(int timeout)
        Returns true if this connection is still valid.
        Specified by:
        isValid in interface java.sql.Connection
        Parameters:
        timeout - the number of seconds to wait for the database to respond (ignored)
        Returns:
        true if the connection is valid.
      • setClientInfo

        public void setClientInfo​(java.lang.String name,
                                  java.lang.String value)
                           throws java.sql.SQLClientInfoException
        Set a client property. This method always throws a SQLClientInfoException in standard mode. In compatibility mode the following properties are supported:
        • DB2: The properties: ApplicationName, ClientAccountingInformation, ClientUser and ClientCorrelationToken are supported.
        • MySQL: All property names are supported.
        • Oracle: All properties in the form <namespace>.<key name> are supported.
        • PostgreSQL: The ApplicationName property is supported.
        For unsupported properties a SQLClientInfoException is thrown.
        Specified by:
        setClientInfo in interface java.sql.Connection
        Parameters:
        name - the name of the property
        value - the value
        Throws:
        java.sql.SQLClientInfoException
      • setClientInfo

        public void setClientInfo​(java.util.Properties properties)
                           throws java.sql.SQLClientInfoException
        Set the client properties. This replaces all existing properties. This method always throws a SQLClientInfoException in standard mode. In compatibility mode some properties may be supported (see setProperty(String, String) for details).
        Specified by:
        setClientInfo in interface java.sql.Connection
        Parameters:
        properties - the properties (ignored)
        Throws:
        java.sql.SQLClientInfoException
      • getClientInfo

        public java.util.Properties getClientInfo()
                                           throws java.sql.SQLException
        Get the client properties.
        Specified by:
        getClientInfo in interface java.sql.Connection
        Returns:
        the property list
        Throws:
        java.sql.SQLException
      • getClientInfo

        public java.lang.String getClientInfo​(java.lang.String name)
                                       throws java.sql.SQLException
        Get a client property.
        Specified by:
        getClientInfo in interface java.sql.Connection
        Parameters:
        name - the client info name
        Returns:
        the property value or null if the property is not found or not supported.
        Throws:
        java.sql.SQLException
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> iface)
                     throws java.sql.SQLException
        Return an object of this class if possible.
        Specified by:
        unwrap in interface java.sql.Wrapper
        Parameters:
        iface - the class
        Returns:
        this
        Throws:
        java.sql.SQLException
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class<?> iface)
                             throws java.sql.SQLException
        Checks if unwrap can return an object of this class.
        Specified by:
        isWrapperFor in interface java.sql.Wrapper
        Parameters:
        iface - the class
        Returns:
        whether or not the interface is assignable from this class
        Throws:
        java.sql.SQLException
      • setSchema

        public void setSchema​(java.lang.String schema)
                       throws java.sql.SQLException
        Sets the given schema name to access. Current implementation is case sensitive, i.e. requires schema name to be passed in correct case.
        Specified by:
        setSchema in interface java.sql.Connection
        Parameters:
        schema - the schema name
        Throws:
        java.sql.SQLException
      • getSchema

        public java.lang.String getSchema()
                                   throws java.sql.SQLException
        Retrieves this current schema name for this connection.
        Specified by:
        getSchema in interface java.sql.Connection
        Returns:
        current schema name
        Throws:
        java.sql.SQLException
      • abort

        public void abort​(java.util.concurrent.Executor executor)
        [Not supported]
        Specified by:
        abort in interface java.sql.Connection
        Parameters:
        executor - the executor used by this method
      • setNetworkTimeout

        public void setNetworkTimeout​(java.util.concurrent.Executor executor,
                                      int milliseconds)
        [Not supported]
        Specified by:
        setNetworkTimeout in interface java.sql.Connection
        Parameters:
        executor - the executor used by this method
        milliseconds - the TCP connection timeout
      • getNetworkTimeout

        public int getNetworkTimeout()
        [Not supported]
        Specified by:
        getNetworkTimeout in interface java.sql.Connection
      • toString

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

        public org.h2.value.ValueTimestampTimeZone currentTimestamp()
        Description copied from interface: CastDataProvider
        Returns the current timestamp with maximum resolution. The value must be the same within a transaction or within execution of a command.
        Specified by:
        currentTimestamp in interface CastDataProvider
        Returns:
        the current timestamp for CURRENT_TIMESTAMP(9)
      • currentTimeZone

        public org.h2.util.TimeZoneProvider currentTimeZone()
        Description copied from interface: CastDataProvider
        Returns the current time zone.
        Specified by:
        currentTimeZone in interface CastDataProvider
        Returns:
        the current time zone
      • zeroBasedEnums

        public boolean zeroBasedEnums()
        Description copied from interface: CastDataProvider
        Returns are ENUM values 0-based.
        Specified by:
        zeroBasedEnums in interface CastDataProvider
        Returns:
        are ENUM values 0-based