org.firebirdsql.gds.ng

## Class FbConnectionProperties

- java.lang.Object
- - org.firebirdsql.gds.ng.AbstractAttachProperties<IConnectionProperties>
  - - org.firebirdsql.gds.ng.FbConnectionProperties

- All Implemented Interfaces:
    IAttachProperties<IConnectionProperties>, IConnectionProperties

      public final class FbConnectionProperties
      extends AbstractAttachProperties<IConnectionProperties>
      implements IConnectionProperties

  Mutable implementation of `IConnectionProperties`
  Since:
    3.0
  Author:
    Mark Rotteveel
  See Also:
    `FbImmutableConnectionProperties`

- - ### Field Summary

    - ### Fields inherited from interface org.firebirdsql.gds.ng.IConnectionProperties

      `DEFAULT_BUFFERS_NUMBER, DEFAULT_DIALECT`

    - ### Fields inherited from interface org.firebirdsql.gds.ng.IAttachProperties

      `DEFAULT_CONNECT_TIMEOUT, DEFAULT_PORT, DEFAULT_SERVER_NAME, DEFAULT_SO_TIMEOUT, DEFAULT_SOCKET_BUFFER_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FbConnectionProperties()` Default constructor for FbConnectionProperties
    `FbConnectionProperties(IConnectionProperties src)` Copy constructor for FbConnectionProperties.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `IConnectionProperties` | `asImmutable()`
    `IConnectionProperties` | `asNewMutable()`
    `protected void` | `dirtied()` Called by setters if they have been called.
    `void` | `fromDpb(DatabaseParameterBuffer dpb)` Deprecated. TODO: This method is only intended to simplify migration of the protocol implementation and needs to be removed.
    `java.lang.String` | `getAttachObjectName()`
    `short` | `getConnectionDialect()` Get the dialect of the client connection
    `java.lang.String` | `getDatabaseName()`
    `DatabaseParameterBuffer` | `getExtraDatabaseParameters()` Gets the extra database parameters.
    `int` | `getPageCacheSize()` Get the page cache size.
    `boolean` | `isColumnLabelForName()` Gets the current setting of `columnLabelForName`
    `boolean` | `isResultSetDefaultHoldable()` Get whether ResultSets are holdable by default.
    `void` | `setColumnLabelForName(boolean columnLabelForName)` Set if `ResultSetMetaData.getColumnName(int)` returns the `columnLabel` instead of the `columnName`.
    `void` | `setConnectionDialect(short connectionDialect)` Set the dialect of the client connection
    `void` | `setDatabaseName(java.lang.String databaseName)`
    `void` | `setPageCacheSize(int pageCacheSize)` Set the page cache size.
    `void` | `setResultSetDefaultHoldable(boolean holdable)` Set if `ResultSet` should be `ResultSet.HOLD_CURSORS_OVER_COMMIT` by default.

    - ### Methods inherited from class org.firebirdsql.gds.ng.AbstractAttachProperties

      `getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getPassword, getPortNumber, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getUser, getWireCrypt, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setPassword, setPortNumber, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setUser, setWireCrypt`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.firebirdsql.gds.ng.IAttachProperties

      `getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getPassword, getPortNumber, getRoleName, getServerName, getSocketBufferSize, getSoTimeout, getUser, getWireCrypt, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setPassword, setPortNumber, setRoleName, setServerName, setSocketBufferSize, setSoTimeout, setUser, setWireCrypt`

- - ### Constructor Detail

    - #### FbConnectionProperties

          public FbConnectionProperties(IConnectionProperties src)

      Copy constructor for FbConnectionProperties.

      All properties defined in `IConnectionProperties` are copied from `src` to the new instance.

      Parameters:
        `src` - Source to copy from

    - #### FbConnectionProperties

          public FbConnectionProperties()

      Default constructor for FbConnectionProperties

  - ### Method Detail

    - #### getDatabaseName

          public java.lang.String getDatabaseName()

      Specified by:
        `getDatabaseName` in interface `IConnectionProperties`
      Returns:
        Name or alias of the database

    - #### setDatabaseName

          public void setDatabaseName(java.lang.String databaseName)

      Specified by:
        `setDatabaseName` in interface `IConnectionProperties`
      Parameters:
        `databaseName` - Name or alias of the database

    - #### getAttachObjectName

          public java.lang.String getAttachObjectName()

      Specified by:
        `getAttachObjectName` in interface `IAttachProperties<IConnectionProperties>`
      Returns:
        The name of the object to attach to (either a database or service name).

    - #### getConnectionDialect

          public short getConnectionDialect()

      Description copied from interface: `IConnectionProperties`
      Get the dialect of the client connection

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

      Specified by:
        `getConnectionDialect` in interface `IConnectionProperties`
      Returns:
        SQL dialect of the client.

    - #### setConnectionDialect

          public void setConnectionDialect(short connectionDialect)

      Description copied from interface: `IConnectionProperties`
      Set the dialect of the client connection

      NOTE: Implementer should take care to use `IConnectionProperties.DEFAULT_DIALECT` if the value hasn't been set yet.

      Specified by:
        `setConnectionDialect` in interface `IConnectionProperties`
      Parameters:
        `connectionDialect` - SQL dialect of the client.

    - #### getPageCacheSize

          public int getPageCacheSize()

      Description copied from interface: `IConnectionProperties`
      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 `IConnectionProperties.DEFAULT_BUFFERS_NUMBER` if the value hasn't been set yet.

      Specified by:
        `getPageCacheSize` in interface `IConnectionProperties`
      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.

    - #### setPageCacheSize

          public void setPageCacheSize(int pageCacheSize)

      Description copied from interface: `IConnectionProperties`
      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)

      NOTE: Implementer should take care to use `IConnectionProperties.DEFAULT_BUFFERS_NUMBER` if the value hasn't been set yet.

      Specified by:
        `setPageCacheSize` in interface `IConnectionProperties`
      Parameters:
        `pageCacheSize` - number of cache buffers that should be allocated for this connection, should be specified for ClassicServer instances, SuperServer has a server-wide configuration parameter.

    - #### setResultSetDefaultHoldable

          public void setResultSetDefaultHoldable(boolean holdable)

      Description copied from interface: `IConnectionProperties`
      Set if `ResultSet` should be `ResultSet.HOLD_CURSORS_OVER_COMMIT` by default.
      Specified by:
        `setResultSetDefaultHoldable` in interface `IConnectionProperties`
      Parameters:
        `holdable` - `true` ResultSets are holdable, `false` (default) ResultSets are `ResultSet.CLOSE_CURSORS_AT_COMMIT`

    - #### isResultSetDefaultHoldable

          public boolean isResultSetDefaultHoldable()

      Description copied from interface: `IConnectionProperties`
      Get whether ResultSets are holdable by default.
      Specified by:
        `isResultSetDefaultHoldable` in interface `IConnectionProperties`
      Returns:
        `true` ResultSets by default are `ResultSet.HOLD_CURSORS_OVER_COMMIT`, `false` (default), ResultSets are `ResultSet.CLOSE_CURSORS_AT_COMMIT`

    - #### setColumnLabelForName

          public void setColumnLabelForName(boolean columnLabelForName)

      Description copied from interface: `IConnectionProperties`
      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 `IConnectionProperties`
      Parameters:
        `columnLabelForName` - `false` JDBC compliant behavior (`columnName` is returned), `true` compatibility option (`columnLabel` is returned)

    - #### isColumnLabelForName

          public boolean isColumnLabelForName()

      Description copied from interface: `IConnectionProperties`
      Gets the current setting of `columnLabelForName`
      Specified by:
        `isColumnLabelForName` in interface `IConnectionProperties`
      Returns:
        `false` JDBC compliant behavior (`columnName` is returned), `true` compatibility option (`columnLabel` is returned)
      See Also:
        `IConnectionProperties.setColumnLabelForName(boolean)`

    - #### getExtraDatabaseParameters

          public DatabaseParameterBuffer getExtraDatabaseParameters()

      Description copied from interface: `IConnectionProperties`
      Gets the extra database parameters. This can be used to pass extra database parameters that are not directly supported.

      An immutable instance of `IConnectionProperties` must return a copy.

      Specified by:
        `getExtraDatabaseParameters` in interface `IConnectionProperties`
      Returns:
        DatabaseParameterBuffer instance.

    - #### asImmutable

          public IConnectionProperties asImmutable()

      Specified by:
        `asImmutable` in interface `IAttachProperties<IConnectionProperties>`
      Specified by:
        `asImmutable` in interface `IConnectionProperties`
      Returns:
        An immutable version of this instance as an implementation of `IConnectionProperties`

    - #### asNewMutable

          public IConnectionProperties asNewMutable()

      Specified by:
        `asNewMutable` in interface `IAttachProperties<IConnectionProperties>`
      Specified by:
        `asNewMutable` in interface `IConnectionProperties`
      Returns:
        A new, mutable, instance as an implementation of `IConnectionProperties` with all properties copied.

    - #### fromDpb

          @Deprecated
          public void fromDpb(DatabaseParameterBuffer dpb)
                       throws java.sql.SQLException

      Deprecated. TODO: This method is only intended to simplify migration of the protocol implementation and needs to be removed.
      Method to populate an FbConnectionProperties from a database parameter buffer.

      Unsupported or unknown properties are ignored.

      Parameters:
        `dpb` - Database parameter buffer
      Throws:
        `java.sql.SQLException`

    - #### dirtied

          protected void dirtied()

      Description copied from class: `AbstractAttachProperties`
      Called by setters if they have been called.
      Specified by:
        `dirtied` in class `AbstractAttachProperties<IConnectionProperties>`

Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.