## org.firebirdsql.jdbc
Class FBDataSource

    java.lang.Object
      org.firebirdsql.jdbc.FBDataSource

All Implemented Interfaces:
  Serializable, Wrapper, Referenceable, CommonDataSource, DataSource

    public class FBDataSource

extends Object
implements DataSource, 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
`FBDataSource(FBManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm)`
`FBDataSource(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionManager cm)`

Method Summary
`Connection` `getConnection()` Attempt to establish a database connection.
`Connection` `getConnection(String username, 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.
`PrintWriter` `getLogWriter()` Get the log writer for this data source.
`Reference` `getReference()` Get the JNDI `Reference` for this DataSource.
`boolean` `isWrapperFor(Class arg0)`
`void` `setLoginTimeout(int seconds)` Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
`void` `setLogWriter(PrintWriter out)` Set the log writer for this data source.
`void` `setReference(Reference ref)` Set the JNDI `Reference` for this DataSource.
`Object` `unwrap(Class arg0)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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(Reference ref)

  Set the JNDI `Reference` for this DataSource.

  Parameters:
    `ref` - The JNDI reference for this DataSource

### getReference

    public Reference getReference()

  Get the JNDI `Reference` for this DataSource.

  Specified by:
    `getReference` in interface `Referenceable`
  Returns:
    The JNDI reference

### getConnection

    public Connection getConnection()
                             throws SQLException

  Attempt to establish a database connection.

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

### getConnection

    public Connection getConnection(String username,
                                    String password)
                             throws SQLException

  Attempt to establish a database connection.

  Specified by:
    `getConnection` in interface `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:
    `SQLException` - if a database-access error occurs.

### getLogWriter

    public PrintWriter getLogWriter()

  Get the log writer for this data source.

  The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a DataSource object is created the log writer is initially null, in other words, logging is disabled.

  Specified by:
    `getLogWriter` in interface `CommonDataSource`
  Returns:
    the log writer for this data source, null if disabled

### setLogWriter

    public void setLogWriter(PrintWriter out)

  Set the log writer for this data source.

  The log writer is a character output stream to which all logging and tracing messages for this data source object instance will be printed. This includes messages printed by the methods of this object, messages printed by methods of other objects manufactured by this object, and so on. Messages printed to a data source specific log writer are not printed to the log writer associated with the java.sql.Drivermanager class. When a DataSource object is created the log writer is initially null, in other words, logging is disabled.

  Specified by:
    `setLogWriter` in interface `CommonDataSource`
  Parameters:
    `out` - the new log writer; to disable, set to null
  Throws:
    `SQLException` - if a database-access error occurs.

### setLoginTimeout

    public void setLoginTimeout(int seconds)
                         throws 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 `CommonDataSource`
  Parameters:
    `seconds` - the data source login time limit
  Throws:
    `SQLException` - if a database access error occurs.

### getLoginTimeout

    public int getLoginTimeout()
                        throws 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 `CommonDataSource`
  Returns:
    the data source login time limit
  Throws:
    `SQLException` - if a database access error occurs.

### isWrapperFor

    public boolean isWrapperFor(Class arg0)
                         throws SQLException

  Specified by:
    `isWrapperFor` in interface `Wrapper`
  Throws:
    `SQLException`

### unwrap

    public Object unwrap(Class arg0)
                  throws SQLException

  Specified by:
    `unwrap` in interface `Wrapper`
  Throws:
    `SQLException`

Copyright © 2001-2010. All Rights Reserved.