org.firebirdsql.jdbc

## Class FBDataSource

- java.lang.Object
- - org.firebirdsql.ds.RootCommonDataSource
  - - org.firebirdsql.jdbc.FBDataSource

- All Implemented Interfaces:
    java.io.Serializable, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.DataSource

      public class FBDataSource
      extends RootCommonDataSource
      implements javax.sql.DataSource, java.io.Serializable, javax.resource.Referenceable

  The class `FBDataSource` is a ConnectionFactory for jdbc Connection objects. All work is delegated to a ConnectionManager.
  Version:
    1.0
  Author:
    David Jencks
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FBDataSource(FBManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm)`
    `FBDataSource(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.sql.Connection` | `getConnection()` Attempt to establish a database connection.
    `java.sql.Connection` | `getConnection(java.lang.String username, java.lang.String password)` Attempt to establish a database connection.
    `int` | `getLoginTimeout()` Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
    `javax.naming.Reference` | `getReference()` Get the JNDI `Reference` for this DataSource.
    `boolean` | `isWrapperFor(java.lang.Class<?> iface)`
    `void` | `setLoginTimeout(int seconds)` Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
    `void` | `setReference(javax.naming.Reference ref)` Set the JNDI `Reference` for this DataSource.
    `<T> T` | `unwrap(java.lang.Class<T> iface)`

    - ### Methods inherited from class org.firebirdsql.ds.RootCommonDataSource

      `getLogWriter, getParentLogger, setLogWriter`

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

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

    - ### Methods inherited from interface javax.sql.CommonDataSource

      `getLogWriter, getParentLogger, setLogWriter`

- - ### Constructor Detail

    - #### FBDataSource

          public FBDataSource(javax.resource.spi.ManagedConnectionFactory mcf,
                      javax.resource.spi.ConnectionManager cm)

    - #### FBDataSource

          public FBDataSource(FBManagedConnectionFactory mcf,
                      javax.resource.spi.ConnectionManager cm)

  - ### Method Detail

    - #### setReference

          public void setReference(javax.naming.Reference ref)

      Set the JNDI `Reference` for this DataSource.
      Parameters:
        `ref` - The JNDI reference for this DataSource

    - #### getReference

          public javax.naming.Reference getReference()

      Get the JNDI `Reference` for this DataSource.
      Specified by:
        `getReference` in interface `javax.naming.Referenceable`
      Returns:
        The JNDI reference

    - #### getConnection

          public java.sql.Connection getConnection()
                                            throws java.sql.SQLException

      Attempt to establish a database connection.

      Specified by:
        `getConnection` in interface `javax.sql.DataSource`
      Returns:
        a Connection to the database
      Throws:
        `java.sql.SQLException` - if a database-access error occurs.

    - #### getConnection

          public java.sql.Connection getConnection(java.lang.String username,
                                          java.lang.String password)
                                            throws java.sql.SQLException

      Attempt to establish a database connection.

      Specified by:
        `getConnection` in interface `javax.sql.DataSource`
      Parameters:
        `username` - the database user on whose behalf the Connection is being made
        `password` - the user's password
      Returns:
        a Connection to the database
      Throws:
        `java.sql.SQLException` - if a database-access error occurs.

    - #### setLoginTimeout

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

      Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise it specifies that there is no timeout. When a DataSource object is created the login timeout is initially zero.

      Specified by:
        `setLoginTimeout` in interface `javax.sql.CommonDataSource`
      Parameters:
        `seconds` - the data source login time limit
      Throws:
        `java.sql.SQLException` - if a database access error occurs.

    - #### getLoginTimeout

          public int getLoginTimeout()
                              throws java.sql.SQLException

      Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. A value of zero means that the timeout is the default system timeout if there is one; otherwise it means that there is no timeout. When a DataSource object is created the login timeout is initially zero.
      Specified by:
        `getLoginTimeout` in interface `javax.sql.CommonDataSource`
      Returns:
        the data source login time limit
      Throws:
        `java.sql.SQLException` - if a database access error occurs.

    - #### isWrapperFor

          public boolean isWrapperFor(java.lang.Class<?> iface)
                               throws java.sql.SQLException

      Specified by:
        `isWrapperFor` in interface `java.sql.Wrapper`
      Throws:
        `java.sql.SQLException`

    - #### unwrap

          public <T> T unwrap(java.lang.Class<T> iface)
                   throws java.sql.SQLException

      Specified by:
        `unwrap` in interface `java.sql.Wrapper`
      Throws:
        `java.sql.SQLException`

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