Class AbstractConnectionPropertiesDataSource

    • Constructor Detail

      • AbstractConnectionPropertiesDataSource

        public AbstractConnectionPropertiesDataSource()
    • Method Detail

      • setServerName

        public void setServerName​(java.lang.String serverName)
        Description copied from interface: AttachmentProperties
        Set the hostname or IP address of the Firebird server.

        When set to null (the default), the databaseName or serviceName is used as the full identification of the database host, port and database path/alias. Protocol implementations, for example PURE_JAVA, may default to localhost when this property is null, but databaseName/serviceName does not (seem to) contain a host name.

        Specified by:
        setServerName in interface AttachmentProperties
        Parameters:
        serverName - Hostname or IP address of the server
      • setPortNumber

        public void setPortNumber​(int portNumber)
        Description copied from interface: AttachmentProperties
        Set the port number of the server.

        Defaults to 3050. This property value will be ignored if serverName is null, unless the protocol implementation needs a hostname, but cannot find a hostname in databaseName/serviceName.

        Specified by:
        setPortNumber in interface AttachmentProperties
        Parameters:
        portNumber - Port number of the server
        See Also:
        AttachmentProperties.setServerName(String)
      • setDatabaseName

        public void setDatabaseName​(java.lang.String databaseName)
        Description copied from interface: DatabaseConnectionProperties
        Sets the database of the connection

        When serverName is null, the value is taken as the URL of the database, and exact interpretation depends on the protocol implementation (type). Basically, the URL would be the JDBC URL, but without the jdbc:firebird[sql]:[subprotocol:] prefix and without connection properties. Examples:

        • //localhost/employee — PURE_JAVA, OOREMOTE, NATIVE (for NATIVE, this format is parsed and transformed to the next example)
        • localhost:employee — NATIVE, PURE_JAVA, OOREMOTE
        • //localhost:3051/employee — PURE_JAVA, OOREMOTE, NATIVE (for NATIVE, this format is parsed and transformed to the next example)
        • localhost/3051:employee — NATIVE, PURE_JAVA, OOREMOTE
        • /path/to/your.fdb — NATIVE, EMBEDDED, PURE_JAVA, OOREMOTE (PURE_JAVA and OOREMOTE will use localhost as serverName, depending on the Firebird version and platform, NATIVE may use Firebird Embedded)
        • C:\path\to\your.fdb — NATIVE, EMBEDDED (protocols like PURE_JAVA may attempt to connect to a server called C, depending on the Firebird version and platform, NATIVE may use Firebird Embedded)
        • C:/path/to/your.fdb — NATIVE, EMBEDDED (protocols like PURE_JAVA may attempt to connect to a server called C, depending on the Firebird version and platform, NATIVE may use Firebird Embedded)
        • xnet://employee — NATIVE (EMBEDDED will behave as NATIVE, protocols like PURE_JAVA may attempt to connect to a server called xnet)
        • other Firebird fbclient connection URLs — NATIVE (EMBEDDED will behave as NATIVE, protocols like PURE_JAVA may interpret the protocol name as a host name
        • Custom type implementations may support other URL formats

        Some protocols, for example PURE_JAVA, when serverName is not set, but databaseName doesn't seem to contain a host name, may default to attempting to connect to localhost with databaseName as the database path or alias.

        When serverName is set, the value is taken as the database path or alias. Examples:

        • employee
        • /path/to/your.fdb
        • C:\path\to\your.fdb
        • C:/path/to/your.fdb
        • relative/path/to/your.fdb — not recommended
        Specified by:
        setDatabaseName in interface DatabaseConnectionProperties
        Parameters:
        databaseName - database name
      • getDatabase

        @Deprecated
        public java.lang.String getDatabase()
        Deprecated.
        Specified by:
        getDatabase in interface FirebirdConnectionProperties
        Returns:
        path to the database including the server name and the port, if needed.
      • setDatabase

        @Deprecated
        public void setDatabase​(java.lang.String database)
        Deprecated.
        Specified by:
        setDatabase in interface FirebirdConnectionProperties
        Parameters:
        database - path to the database including the server name and the port, if needed.
      • getType

        public java.lang.String getType()
        Specified by:
        getType in interface AttachmentProperties
        Returns:
        type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS implementations installed in the system.
      • setType

        public void setType​(java.lang.String type)
        Specified by:
        setType in interface AttachmentProperties
        Parameters:
        type - type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS implementations installed in the system.
      • getUser

        public java.lang.String getUser()
        Specified by:
        getUser in interface AttachmentProperties
        Returns:
        Name of the user to authenticate to the server.
      • setUser

        public void setUser​(java.lang.String user)
        Specified by:
        setUser in interface AttachmentProperties
        Parameters:
        user - Name of the user to authenticate to the server.
      • getPassword

        public java.lang.String getPassword()
        Specified by:
        getPassword in interface AttachmentProperties
        Returns:
        Password to authenticate to the server.
      • setPassword

        public void setPassword​(java.lang.String password)
        Specified by:
        setPassword in interface AttachmentProperties
        Parameters:
        password - Password to authenticate to the server.
      • setRoleName

        public void setRoleName​(java.lang.String roleName)
        Specified by:
        setRoleName in interface AttachmentProperties
        Parameters:
        roleName - SQL role to use.
      • getCharSet

        public java.lang.String getCharSet()
        Description copied from interface: AttachmentProperties
        Java character set configured for the connection.

        After connect, the actual Java character set applied can be obtained from FbAttachment.getEncoding() (property charsetName), or FbAttachment.getEncodingFactory() (properties defaultEncoding.charsetName or {code defaultEncodingDefinition.javaCharset}).

        Specified by:
        getCharSet in interface AttachmentProperties
        Returns:
        Java character set for the connection (null when not explicitly configured).
      • setCharSet

        public void setCharSet​(java.lang.String charSet)
        Description copied from interface: AttachmentProperties
        Set the Java character set for the connection.

        It is possible to set both the charSet and encoding to achieve a character set conversion effect, but in general only one of both properties should be set.

        Specified by:
        setCharSet in interface AttachmentProperties
        Parameters:
        charSet - Character set for the connection. Similar to encoding property, but accepts Java names instead of Firebird ones.
        See Also:
        AttachmentProperties.setEncoding(String)
      • getEncoding

        public java.lang.String getEncoding()
        Description copied from interface: AttachmentProperties
        Firebird character set configured for the connection.

        After connect, the actual Firebird character set applied can be obtained from FbAttachment.getEncodingFactory(), property defaultEncodingDefinition.firebirdEncodingName.

        Specified by:
        getEncoding in interface AttachmentProperties
        Returns:
        Firebird character encoding for the connection (null when not explicitly configured).
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
        Description copied from interface: AttachmentProperties
        Set the Firebird character set for the connection.

        It is possible to set both the charSet and encoding to achieve a character set conversion effect, but in general only one of both properties should be set.

        Specified by:
        setEncoding in interface AttachmentProperties
        Parameters:
        encoding - Firebird character encoding for the connection. See Firebird documentation for more information.
        See Also:
        AttachmentProperties.setCharSet(String)
      • getProcessId

        public java.lang.Integer getProcessId()
        Specified by:
        getProcessId in interface AttachmentProperties
        Returns:
        Custom process id sent to Firebird on attach; null means the default is applied (read from system property org.firebirdsql.jdbc.pid, future versions may also determine the actual process id)
      • getProcessName

        public java.lang.String getProcessName()
        Specified by:
        getProcessName in interface AttachmentProperties
        Returns:
        Custom process name sent to Firebird on attach; null means the default is applied (read from system property org.firebirdsql.jdbc.processName)
      • setSocketBufferSize

        public void setSocketBufferSize​(int socketBufferSize)
        Description copied from interface: AttachmentProperties
        Set the socket buffer size.
        Specified by:
        setSocketBufferSize in interface AttachmentProperties
        Parameters:
        socketBufferSize - socket buffer size in bytes.
      • getSoTimeout

        public int getSoTimeout()
        Description copied from interface: AttachmentProperties
        Get the initial Socket blocking timeout (SoTimeout).
        Specified by:
        getSoTimeout in interface AttachmentProperties
        Returns:
        The initial socket blocking timeout in milliseconds (0 is 'infinite'), or -1 if not set
      • setSoTimeout

        public void setSoTimeout​(int soTimeout)
        Description copied from interface: AttachmentProperties
        Set the initial Socket blocking timeout (SoTimeout).
        Specified by:
        setSoTimeout in interface AttachmentProperties
        Parameters:
        soTimeout - Timeout in milliseconds (0 is 'infinite')
      • getConnectTimeout

        public int getConnectTimeout()
        Description copied from interface: AttachmentProperties
        Get the connect timeout in seconds.
        Specified by:
        getConnectTimeout in interface AttachmentProperties
        Returns:
        Connect timeout in seconds (0 is 'infinite', or better: OS specific timeout), or -1 if not set
      • setConnectTimeout

        public void setConnectTimeout​(int connectTimeout)
        Description copied from interface: AttachmentProperties
        Set the connect timeout in seconds.
        Specified by:
        setConnectTimeout in interface AttachmentProperties
        Parameters:
        connectTimeout - Connect timeout in seconds (0 is 'infinite', or better: OS specific timeout)
      • getLoginTimeout

        public int getLoginTimeout()
                            throws java.sql.SQLException

        This property is an alias for the connectTimeout property.

        Specified by:
        getLoginTimeout in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLException
      • setLoginTimeout

        public void setLoginTimeout​(int seconds)
                             throws java.sql.SQLException

        This property is an alias for the connectTimeout property.

        Specified by:
        setLoginTimeout in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLException
      • setWireCrypt

        public void setWireCrypt​(java.lang.String wireCrypt)
        Description copied from interface: AttachmentProperties
        Set the wire encryption level.

        Values are defined by WireCrypt, values are handled case insensitive. Invalid values will throw an exception.

        Specified by:
        setWireCrypt in interface AttachmentProperties
        Parameters:
        wireCrypt - Wire encryption level (null not allowed)
      • getDbCryptConfig

        public java.lang.String getDbCryptConfig()
        Description copied from interface: AttachmentProperties
        Get the database encryption plugin configuration.
        Specified by:
        getDbCryptConfig in interface AttachmentProperties
        Returns:
        Database encryption plugin configuration, meaning plugin specific
      • setDbCryptConfig

        public void setDbCryptConfig​(java.lang.String dbCryptConfig)
        Description copied from interface: AttachmentProperties
        Sets the database encryption plugin configuration.
        Specified by:
        setDbCryptConfig in interface AttachmentProperties
        Parameters:
        dbCryptConfig - Database encryption plugin configuration, meaning plugin specific
      • getAuthPlugins

        public java.lang.String getAuthPlugins()
        Description copied from interface: AttachmentProperties
        Get the list of authentication plugins to try.
        Specified by:
        getAuthPlugins in interface AttachmentProperties
        Returns:
        comma-separated list of authentication plugins
      • setAuthPlugins

        public void setAuthPlugins​(java.lang.String authPlugins)
        Description copied from interface: AttachmentProperties
        Sets the authentication plugins to try.

        Invalid names are skipped during authentication.

        Specified by:
        setAuthPlugins in interface AttachmentProperties
        Parameters:
        authPlugins - comma-separated list of authentication plugins
      • isWireCompression

        public boolean isWireCompression()
        Description copied from interface: AttachmentProperties
        Get if wire compression should be enabled.

        Wire compression requires Firebird 3 or higher, and the server must have the zlib library. If compression cannot be negotiated, the connection will be made without wire compression.

        This property will be ignored for native connections. For native connections, the configuration in firebird.conf read by the client library will be used.

        Specified by:
        isWireCompression in interface AttachmentProperties
        Returns:
        true wire compression enabled
      • getPageCacheSize

        public int getPageCacheSize()
        Description copied from interface: DatabaseConnectionProperties
        Get the page cache size.

        A value of 0 indicates that the value is not set, and that the server default is used.

        This option is only relevant for Firebird implementations with per connection cache (eg Classic)

        NOTE: Implementer should take care to return 0 if the value hasn't been set yet.

        Specified by:
        getPageCacheSize in interface DatabaseConnectionProperties
        Returns:
        size of cache in pages for this connection, can be specified for Classic and SuperClassic instances, ignored for SuperServer as the cache is shared; 0 when not set
      • setPageCacheSize

        public void setPageCacheSize​(int pageCacheSize)
        Description copied from interface: DatabaseConnectionProperties
        Set the page cache size.

        A value of 0 indicates that the value is not set, and that the server default is used.

        This option is only relevant for Firebird implementations with per connection cache (eg Classic).

        Specified by:
        setPageCacheSize in interface DatabaseConnectionProperties
        Parameters:
        pageCacheSize - size of cache in pages for this connection, can be specified for Classic and SuperClassic instances ignored for SuperServer as the cache is shared.
      • setDataTypeBind

        public void setDataTypeBind​(java.lang.String dataTypeBind)
        Description copied from interface: DatabaseConnectionProperties
        Sets the dataTypeBind configuration.

        If the value is explicitly set to a non-null value and the connected server is Firebird 4 or higher, this will configure the data type binding with the specified values using isc_dpb_set_bind, which is equivalent to executing SET BIND statements with the values.

        See also Firebird documentation for SET BIND.

        Specified by:
        setDataTypeBind in interface DatabaseConnectionProperties
        Parameters:
        dataTypeBind - Firebird 4+ data type bind configuration, a semicolon-separated list of <from-type> TO <to-type>
      • setSessionTimeZone

        public void setSessionTimeZone​(java.lang.String sessionTimeZone)
        Description copied from interface: DatabaseConnectionProperties
        Sets the sessionTimeZone.
        Specified by:
        setSessionTimeZone in interface DatabaseConnectionProperties
        Parameters:
        sessionTimeZone - Firebird 4+ session time zone name (we strongly suggest to use Java compatible names only), use "server" to use server default time zone (note: conversion will use JVM default time zone)
      • setUseStreamBlobs

        public void setUseStreamBlobs​(boolean useStreamBlobs)
        Specified by:
        setUseStreamBlobs in interface DatabaseConnectionProperties
        Parameters:
        useStreamBlobs - true if stream blobs should be created, otherwise false.
      • isDefaultResultSetHoldable

        public boolean isDefaultResultSetHoldable()
        Description copied from interface: DatabaseConnectionProperties
        Get whether ResultSets are holdable by default.
        Specified by:
        isDefaultResultSetHoldable in interface DatabaseConnectionProperties
        Returns:
        true ResultSets by default are ResultSet.HOLD_CURSORS_OVER_COMMIT, false (default), ResultSets are ResultSet.CLOSE_CURSORS_AT_COMMIT
      • setDefaultResultSetHoldable

        public void setDefaultResultSetHoldable​(boolean defaultResultSetHoldable)
        Description copied from interface: DatabaseConnectionProperties
        Set if ResultSet should be ResultSet.HOLD_CURSORS_OVER_COMMIT by default.
        Specified by:
        setDefaultResultSetHoldable in interface DatabaseConnectionProperties
        Parameters:
        defaultResultSetHoldable - true ResultSets are holdable, false (default) ResultSets are ResultSet.CLOSE_CURSORS_AT_COMMIT
      • setColumnLabelForName

        public void setColumnLabelForName​(boolean columnLabelForName)
        Description copied from interface: DatabaseConnectionProperties
        Set if ResultSetMetaData.getColumnName(int) returns the columnLabel instead of the columnName.

        The default behaviour (with columnLabelForName=false is JDBC-compliant. The behavior for value true is to provide compatibility with tools with a wrong expectation.

        Specified by:
        setColumnLabelForName in interface DatabaseConnectionProperties
        Parameters:
        columnLabelForName - false JDBC compliant behavior (columnName is returned), true compatibility option (columnLabel is returned)
      • setGeneratedKeysEnabled

        public void setGeneratedKeysEnabled​(java.lang.String generatedKeysEnabled)
        Description copied from interface: DatabaseConnectionProperties
        Sets the generatedKeysEnabled configuration.
        Specified by:
        setGeneratedKeysEnabled in interface DatabaseConnectionProperties
        Parameters:
        generatedKeysEnabled - Generated keys support configuration: default (or null/empty), disabled, ignored, or a list of statement types to enable (possible values: insert, update, delete, update_or_insert, merge)
      • setIgnoreProcedureType

        public void setIgnoreProcedureType​(boolean ignoreProcedureType)
        Description copied from interface: DatabaseConnectionProperties
        Sets the value ignoreProcedureType.

        When set to true, the CallableStatement implementation in Jaybird will ignore metadata information about the stored procedure type and default to using EXECUTE PROCEDURE, unless the type is explicitly set using FirebirdCallableStatement.setSelectableProcedure(boolean). This can be useful in situations where a stored procedure is selectable, but tooling or code expects an executable stored procedure.

        Specified by:
        setIgnoreProcedureType in interface DatabaseConnectionProperties
        Parameters:
        ignoreProcedureType - true Ignore procedure type
      • getDecfloatRound

        public java.lang.String getDecfloatRound()
        Specified by:
        getDecfloatRound in interface DatabaseConnectionProperties
        Returns:
        the server-side DECFLOAT rounding mode, null applies the Firebird server default
      • setDecfloatRound

        public void setDecfloatRound​(java.lang.String decfloatRound)
        Description copied from interface: DatabaseConnectionProperties
        Sets the DECFLOAT rounding mode
        Specified by:
        setDecfloatRound in interface DatabaseConnectionProperties
        Parameters:
        decfloatRound - Firebird 4+ server-side DECFLOAT rounding mode (ceiling, up, half_up, half_even, half_down, down, floor, reround); null to apply the Firebird server default (half_up in Firebird 4)
      • getDecfloatTraps

        public java.lang.String getDecfloatTraps()
        Specified by:
        getDecfloatTraps in interface DatabaseConnectionProperties
        Returns:
        the server-side DECFLOAT error traps, null applies the Firebird server default
      • setDecfloatTraps

        public void setDecfloatTraps​(java.lang.String decfloatTraps)
        Description copied from interface: DatabaseConnectionProperties
        Sets the DECFLOAT error traps.
        Specified by:
        setDecfloatTraps in interface DatabaseConnectionProperties
        Parameters:
        decfloatTraps - Firebird 4+ server-side DECFLOAT error traps; comma-separated list with options Division_by_zero, Inexact, Invalid_operation, Overflow, Underflow; null to apply Firebird server default (Division_by_zero,Invalid_operation,Overflow in Firebird 4)
      • setTpbMapping

        public void setTpbMapping​(java.lang.String tpbMapping)
        Description copied from interface: DatabaseConnectionProperties
        Set path to the properties file with the TPB mapping. The path begins with the protocol specification followed by the path to the resource. A special protocol "res:" should be used to specify resource in the classpath.

        For compatibility reasons, if no protocol is specified, classpath is used by default.

        Properties file contains a mapping between the transaction isolation level (name of the constant in the Connection interface and a comma-separated list of TPB parameters).

        Specified by:
        setTpbMapping in interface DatabaseConnectionProperties
        Parameters:
        tpbMapping - path to the properties file
      • setDefaultIsolation

        public void setDefaultIsolation​(java.lang.String isolation)
        Description copied from interface: DatabaseConnectionProperties
        Set the default transaction isolation level as string. This method is complementary to DatabaseConnectionProperties.setDefaultTransactionIsolation(int), however it takes a string as parameter instead of a numeric constant.

        Following strings are allowed:

        • "TRANSACTION_READ_COMMITTED" for a READ COMMITTED isolation level.
        • "TRANSACTION_REPEATABLE_READ" for a REPEATABLE READ isolation level.
        • "TRANSACTION_SERIALIZABLE" for a SERIALIZABLE isolation level.
        • Integer string values matching the isolation levels

        Specified by:
        setDefaultIsolation in interface DatabaseConnectionProperties
        Parameters:
        isolation - string constant representing a default isolation level.
      • setScrollableCursor

        public void setScrollableCursor​(java.lang.String scrollableCursor)
        Description copied from interface: DatabaseConnectionProperties
        Sets the type of scrollable cursor.

        Possible values are (case-insensitive):

        • EMULATED (default) - emulate scrollable cursors in memory by fetching all rows
        • SERVER - user server-side scrollable cursor (requires Firebird 5.0 and pure-java connection). Falls back to EMULATED behaviour when server-side support is not available, or when holdable cursors are requested
        Specified by:
        setScrollableCursor in interface DatabaseConnectionProperties
        Parameters:
        scrollableCursor - Scrollable cursor type, one of EMULATED or SERVER (case-insensitive)
      • setUseServerBatch

        public void setUseServerBatch​(boolean useServerBatch)
        Description copied from interface: DatabaseConnectionProperties
        Sets whether to use server-side batch support, if available.

        Currently, server-side batch is only supported with Firebird 4.0 or higher, with a pure Java connection, using a PreparedStatement, but not a CallableStatement, and only when not requesting generated keys.

        The implementation will fall back to emulated batches if either the server version doesn't support batches, or if the statement cannot be executed using the server-side batch mechanism for other reasons (e.g. requesting generated keys).

        Specified by:
        setUseServerBatch in interface DatabaseConnectionProperties
        Parameters:
        useServerBatch - true, use server-side batch support if possible, false always use emulated batch
      • setServerBatchBufferSize

        public void setServerBatchBufferSize​(int serverBatchBufferSize)
        Description copied from interface: DatabaseConnectionProperties
        Sets the server batch buffer size (if server batch is supported and enabled).
        Specified by:
        setServerBatchBufferSize in interface DatabaseConnectionProperties
        Parameters:
        serverBatchBufferSize - server batch buffer size in bytes, use < 0 to set server-side default (16MB as of Firebird 4.0), use 0 to use server-side maximum (256MB as of Firebird 4.0), values exceeding server-side maximum will set server-side maximum
      • getParallelWorkers

        public int getParallelWorkers()
        Specified by:
        getParallelWorkers in interface AttachmentProperties
        Returns:
        number of parallel workers, -1 means no value was set (or it was explicitly set to -1)
      • setParallelWorkers

        public void setParallelWorkers​(int parallelWorkers)
        Description copied from interface: AttachmentProperties
        Sets the number of parallel workers of the connection.

        Requires Firebird 5.0 or higher, and a Firebird server configured with MaxParallelWorkers higher than specified by parallelWorkers.

        NOTE: For service attachments, this property controls behaviour only for specific operations, and requires Jaybird to explicitly set the parallel workers for that operation.

        Specified by:
        setParallelWorkers in interface AttachmentProperties
        Parameters:
        parallelWorkers - number of parallel workers
      • isTimestampUsesLocalTimezone

        @Deprecated
        public boolean isTimestampUsesLocalTimezone()
        Deprecated.
        Specified by:
        isTimestampUsesLocalTimezone in interface DatabaseConnectionProperties
        Returns:
        true if the Jaybird 1.0 handling of the calendar in corresponding setters. This is also compatible with MySQL calendar treatment.
      • setTimestampUsesLocalTimezone

        @Deprecated
        public void setTimestampUsesLocalTimezone​(boolean timestampUsesLocalTimezone)
        Deprecated.
        Description copied from interface: DatabaseConnectionProperties
        Sets the value timestampUsesLocalTimezone.
        Specified by:
        setTimestampUsesLocalTimezone in interface DatabaseConnectionProperties
        Parameters:
        timestampUsesLocalTimezone - true if the Jaybird 1.0 handling of the calendar in corresponding setters. This is also compatible with MySQL calendar treatment.
      • getUserName

        @Deprecated
        public java.lang.String getUserName()
        Deprecated.
        Specified by:
        getUserName in interface FirebirdConnectionProperties
        Returns:
        name of the user that will be used when connecting to the database.
      • setUserName

        @Deprecated
        public void setUserName​(java.lang.String userName)
        Deprecated.
        Specified by:
        setUserName in interface FirebirdConnectionProperties
        Parameters:
        userName - name of the user that will be used when connecting to the database.
      • getBuffersNumber

        @Deprecated
        public int getBuffersNumber()
        Deprecated.
        Specified by:
        getBuffersNumber in interface FirebirdConnectionProperties
        Returns:
        number of cache buffers that should be allocated for this connection, should be specified for ClassicServer instances, SuperServer has a server-wide configuration parameter.
      • setBuffersNumber

        @Deprecated
        public void setBuffersNumber​(int buffersNumber)
        Deprecated.
        Specified by:
        setBuffersNumber in interface FirebirdConnectionProperties
        Parameters:
        buffersNumber - number of cache buffers that should be allocated for this connection, should be specified for ClassicServer instances, SuperServer has a server-wide configuration parameter.