com.ibm.db.base
Class DatabaseConnectionSpec

java.lang.Object
  |
  +--com.ibm.db.base.DatabaseConnectionSpec

public class DatabaseConnectionSpec
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

See Also:
Serialized Form

Field Summary
private  java.lang.String alias
           
private  int connectionPoolType
           
private static java.lang.String copyright
           
private  java.lang.String dataSourceName
           
private  java.lang.String driverName
           
private  java.lang.String initialContext
           
private  java.lang.String jndiDataSource
           
private  DatabaseLogonSpec logonSpec
           
static int POOL_TYPE_NONE
           
static int POOL_TYPE_WEBSPHERE
           
private  boolean promptUID
           
private  java.util.Properties props
           
private  java.lang.String providerURL
           
(package private) static long serialVersionUID
           
 
Constructor Summary
DatabaseConnectionSpec(java.lang.String aDriverName, java.lang.String aDataSourceName)
          Constructs a new DatabaseConnectionSpec and sets the driver and data source name
DatabaseConnectionSpec(java.lang.String anAlias, java.lang.String aDriverName, java.lang.String aDataSourceName)
          Constructs a new DatabaseConnectionSPec and sets the driver, data source name, and alias.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of the DatabaseConnectionSpec.
 DatabaseConnection connect()
          Return a connection object after successfully connecting using the supplied connection info.
 boolean disconnect()
          Unregisters the connection with the JDBCConnectionManager and disconnects the connection if there are no other registered users for the connection.
 java.lang.String getAlias()
          Returns the alias that identifies this connection spec.
 int getConnectionPoolType()
          Returns the data source name.
 java.lang.String getDataSourceName()
          Returns the data source name.
 java.lang.String getDriverName()
          Returns the JDBC driver name.
 java.lang.String getId()
          Returns the userID.
 java.lang.String getInitialContextFactory()
          Returns the data source name.
 java.lang.String getJndiDataSource()
          Returns the data source name.
 DatabaseLogonSpec getLogonSpec()
          Returns the logon spec.
 java.lang.String getPassword()
          Returns the password.
 boolean getPromptUID()
          Returns true if the user requested to be prompted for the userid and password prior to connecting to the database.
 java.util.Properties getProps()
          Returns the properties associated with the connection.
 java.lang.String getProviderURL()
          Gets the provider URL.
 void setAlias(java.lang.String anAlias)
          Sets the alias of this connection spec.
 void setConnectionPoolType(int aConnectionPoolType)
          Sets the data source name.
 void setDataSourceName(java.lang.String aDataSourceName)
          Sets the data source name.
 void setDriverName(java.lang.String aDriverName)
          Sets the JDBC driver name.
 void setId(java.lang.String id)
          Sets the userID.
 void setInitialContextFactory(java.lang.String aInitialContext)
          Sets the data source name.
 void setJndiDataSource(java.lang.String aJndiDataSource)
          Sets the data source name.
 void setLogonSpec(DatabaseLogonSpec aLogonSpec)
          Sets the user supplied logon spec.
 void setPassword(java.lang.String password)
          Sets the password.
 void setPromptUID(boolean in)
          If true, the user requests to be prompted for a userid and password before a connection is made.
 void setProps(java.util.Properties p)
           
 void setProviderURL(java.lang.String aProviderURL)
          Sets the provider URL
 
Methods inherited from class java.lang.Object
, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

driverName

private java.lang.String driverName

dataSourceName

private java.lang.String dataSourceName

alias

private java.lang.String alias

logonSpec

private DatabaseLogonSpec logonSpec

promptUID

private boolean promptUID

props

private java.util.Properties props

jndiDataSource

private java.lang.String jndiDataSource

initialContext

private java.lang.String initialContext

providerURL

private java.lang.String providerURL

POOL_TYPE_NONE

public static final int POOL_TYPE_NONE

POOL_TYPE_WEBSPHERE

public static final int POOL_TYPE_WEBSPHERE

connectionPoolType

private int connectionPoolType

serialVersionUID

static final long serialVersionUID

copyright

private static final java.lang.String copyright
Constructor Detail

DatabaseConnectionSpec

public DatabaseConnectionSpec(java.lang.String aDriverName,
                              java.lang.String aDataSourceName)
Constructs a new DatabaseConnectionSpec and sets the driver and data source name

DatabaseConnectionSpec

public DatabaseConnectionSpec(java.lang.String anAlias,
                              java.lang.String aDriverName,
                              java.lang.String aDataSourceName)
Constructs a new DatabaseConnectionSPec and sets the driver, data source name, and alias.
Method Detail

clone

public java.lang.Object clone()
Returns a clone of the DatabaseConnectionSpec.
Overrides:
clone in class java.lang.Object

connect

public DatabaseConnection connect()
                           throws java.sql.SQLException,
                                  java.lang.ClassNotFoundException,
                                  DataException
Return a connection object after successfully connecting using the supplied connection info.

disconnect

public boolean disconnect()
                   throws java.sql.SQLException,
                          DataException,
                          java.lang.ClassNotFoundException
Unregisters the connection with the JDBCConnectionManager and disconnects the connection if there are no other registered users for the connection.

.Returns false if the DatabaseConnectionSpec does not represent a registered connection with the JDBCConnectionManager. A disconnect is not done for unregistered connections.


getAlias

public java.lang.String getAlias()
Returns the alias that identifies this connection spec.

getConnectionPoolType

public int getConnectionPoolType()
Returns the data source name.

getDataSourceName

public java.lang.String getDataSourceName()
Returns the data source name.

getDriverName

public java.lang.String getDriverName()
Returns the JDBC driver name.

getId

public java.lang.String getId()
Returns the userID.

getInitialContextFactory

public java.lang.String getInitialContextFactory()
Returns the data source name.

getJndiDataSource

public java.lang.String getJndiDataSource()
Returns the data source name.

getLogonSpec

public DatabaseLogonSpec getLogonSpec()
Returns the logon spec.

getPassword

public java.lang.String getPassword()
Returns the password.

getPromptUID

public boolean getPromptUID()
Returns true if the user requested to be prompted for the userid and password prior to connecting to the database.

getProps

public java.util.Properties getProps()
Returns the properties associated with the connection.

getProviderURL

public java.lang.String getProviderURL()
Gets the provider URL.

setAlias

public void setAlias(java.lang.String anAlias)
Sets the alias of this connection spec.

setConnectionPoolType

public void setConnectionPoolType(int aConnectionPoolType)
                           throws DataException
Sets the data source name.

setDataSourceName

public void setDataSourceName(java.lang.String aDataSourceName)
Sets the data source name.

setDriverName

public void setDriverName(java.lang.String aDriverName)
Sets the JDBC driver name.

setId

public void setId(java.lang.String id)
Sets the userID.

setInitialContextFactory

public void setInitialContextFactory(java.lang.String aInitialContext)
Sets the data source name.

setJndiDataSource

public void setJndiDataSource(java.lang.String aJndiDataSource)
Sets the data source name.

setLogonSpec

public void setLogonSpec(DatabaseLogonSpec aLogonSpec)
Sets the user supplied logon spec.

setPassword

public void setPassword(java.lang.String password)
Sets the password.

setPromptUID

public void setPromptUID(boolean in)
If true, the user requests to be prompted for a userid and password before a connection is made.

The default value of this property is false.

Parameters:
promptUID - true - prompt for userid/password; false - don't prompt
See Also:
getPromptUID()

setProps

public void setProps(java.util.Properties p)

setProviderURL

public void setProviderURL(java.lang.String aProviderURL)
Sets the provider URL