i-net DB2 drivers

com.inet.drda
Class PDataSource

java.lang.Object
  extended by com.inet.drda.DRDADataSource
      extended by com.inet.drda.PDataSource
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource

public class PDataSource
extends DRDADataSource
implements javax.sql.ConnectionPoolDataSource

This class is the implementation of the ConnectionPoolDataSource in the driver. A sample can be found in the file sample/WithPoolDataSource.java.

See Also:
Serialized Form

Constructor Summary
PDataSource()
          Create an empty DataSource.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this ConnectionPoolDataSource to the specified object.
 java.sql.Connection getConnection()
          override the method in TdsDataSource.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          override the method in TdsDataSource.
 java.lang.String getFailoverListener()
          Returns the value of the property failoverListener.
 int getInitialPoolSize()
          Get the number of physical connections the pool should contain when it is created.
 int getMaxIdleTime()
          Get the number of seconds that a physical connection should remain unused in the pool before the connection is closed.
 int getMaxPoolSize()
          Get the maximum number of physical connections that the pool should contain.
 int getMaxStatements()
          Get the total number of statements that the pool should keep open.
 int getMinPoolSize()
          Get the number of physical connections the pool should keep available at all times.
 javax.sql.PooledConnection getPooledConnection()
          This method creates a real connection to the SQL Server with the parameter of this DataSource.
 javax.sql.PooledConnection getPooledConnection(java.lang.String user, java.lang.String password)
          This method creates a real connection to the SQL Server with the parameter of this DataSource.
 int getPropertyCycle()
          Get the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the above connection pool properties.
 int getTotalTimeOfAttempts()
          Returns the value of the property totalTimeOfAttempts.
 boolean getUseDefaultFailoverListener()
          Returns the value of the property useDefaultFailoverListener.
 int getWaitTimeToNextAttempt()
          Returns the value of the property waitTimeToNextAttempt.
 void setFailoverListener(java.lang.String failoverListener)
          Sets the property failoverListener.
 void setInitialPoolSize(int initialPoolSize)
          Set the number of physical connections the pool should contain when it is created.
 void setMaxIdleTime(int maxIdleTime)
          Set the number of seconds that a physical connection should remain unused in the pool before the connection is closed.
 void setMaxPoolSize(int maxPoolSize)
          Set the maximum number of physical connections that the pool should contain.
 void setMaxStatements(int maxStatements)
          Set the total number of statements that the pool should keep open.
 void setMinPoolSize(int minPoolSize)
          Set the number of physical connections the pool should keep available at all times.
 void setPropertyCycle(int propertyCycle)
          Set the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the above connection pool properties.
 void setTotalTimeOfAttempts(int totalTimeOfAttempts)
          Sets the property totalTimeOfAttempts.
 void setUseDefaultFailoverListener(boolean useDefaultFailoverListener)
          Sets the property useDefaultFailoverListener.
 void setWaitTimeToNextAttempt(int waitTimeToNextAttempt)
          Sets the property waitTimeToNextAttempt.
 
Methods inherited from class com.inet.drda.DRDADataSource
addWarning, clone, getDatabaseName, getDescription, getInitSQL, getLoginTimeout, getLogWriter, getPassword, getPort, getPortNumber, getProperties, getProperty, getQueryTimeout, getReference, getServerName, getUser, setDatabaseName, setDescription, setInitSQL, setLoginTimeout, setLogWriter, setPassword, setPort, setPortNumber, setProperties, setProperty, setProperty, setQueryTimeout, setServerName, setUser, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Constructor Detail

PDataSource

public PDataSource()
            throws java.sql.SQLException
Create an empty DataSource.

Throws:
java.sql.SQLException
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
override the method in TdsDataSource. This method gets a connection from the pool manager i-net PLEXA(tm). The connection is a pooled connection.

Specified by:
getConnection in interface javax.sql.DataSource
Overrides:
getConnection in class DRDADataSource
Returns:
a connection from a pool
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
DRDADataSource.getConnection()

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
override the method in TdsDataSource. This method gets a connection from the pool manager i-net PLEXA(tm). The connection is a pooled connection.

Specified by:
getConnection in interface javax.sql.DataSource
Overrides:
getConnection in class DRDADataSource
Parameters:
username -
password -
Returns:
a connection from a pool
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
DRDADataSource.getConnection(String,String)

getPooledConnection

public javax.sql.PooledConnection getPooledConnection()
                                               throws java.sql.SQLException
This method creates a real connection to the SQL Server with the parameter of this DataSource. The real connection is packed in a PooledConnection.

Specified by:
getPooledConnection in interface javax.sql.ConnectionPoolDataSource
Returns:
a PooledConnection for this DataSource.
Throws:
java.sql.SQLException - if a database-access error occurs.

getPooledConnection

public javax.sql.PooledConnection getPooledConnection(java.lang.String user,
                                                      java.lang.String password)
                                               throws java.sql.SQLException
This method creates a real connection to the SQL Server with the parameter of this DataSource. The real connection is packed in a PooledConnection.

Specified by:
getPooledConnection in interface javax.sql.ConnectionPoolDataSource
Parameters:
user - the database user on whose behalf the Connection is being made.
password - the user's password.
Returns:
a PooledConnection for this DataSource.
Throws:
java.sql.SQLException - if a database-access error occurs.

equals

public boolean equals(java.lang.Object obj)
Compares this ConnectionPoolDataSource to the specified object.

Overrides:
equals in class DRDADataSource
Parameters:
obj - the object to compare.
Returns:
true if and only if the argument is not null and if it is a PDataSource object that has the same significant properties

setMaxStatements

public void setMaxStatements(int maxStatements)
Set the total number of statements that the pool should keep open.

An application server managing a pool of PooledConnection objects uses these properties to determine how to manage its pool. i-net PLEXA and the method getConnection() is not using this property.

Parameters:
maxStatements - number of statements that the pool should keep open. 0 (zero) indicates that caching of statements is disabled.
See Also:
getMaxStatements()

getMaxStatements

public int getMaxStatements()
Get the total number of statements that the pool should keep open. This feature is only available with a JDBC 3.0 driver

Returns:
the total number of statements that the pool should keep open. 0 (zero) indicates that caching of statements is disabled.
See Also:
setMaxStatements(int)

setInitialPoolSize

public void setInitialPoolSize(int initialPoolSize)
Set the number of physical connections the pool should contain when it is created.

i-net PLEXA(tm) and the method getConnection() use this property.

Parameters:
initialPoolSize - the number of physical connections the pool should contain when it is created.
See Also:
getInitialPoolSize()

getInitialPoolSize

public int getInitialPoolSize()
Get the number of physical connections the pool should contain when it is created.

Returns:
the number of physical connections the pool should contain when it is created.
See Also:
setInitialPoolSize(int)

setMinPoolSize

public void setMinPoolSize(int minPoolSize)
Set the number of physical connections the pool should keep available at all times.

i-net PLEXA(tm) and the method getConnection() use this property.

Parameters:
minPoolSize - the number of physical connections the pool should keep available at all times.
See Also:
getMinPoolSize()

getMinPoolSize

public int getMinPoolSize()
Get the number of physical connections the pool should keep available at all times.

Returns:
the number of physical connections the pool should keep available at all times. 0 (zero) indicates that connections should be created as needed.
See Also:
setMinPoolSize(int)

setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)
Set the maximum number of physical connections that the pool should contain.

i-net PLEXA(tm) and the method getConnection() use this property.

Parameters:
maxPoolSize - the maximum number of physical connections that the pool should contain. 0 (zero) indicates no maximum size.
See Also:
getMaxPoolSize(), PoolManager.setMaxPoolSize(int)

getMaxPoolSize

public int getMaxPoolSize()
Get the maximum number of physical connections that the pool should contain.

Returns:
the maximum number of physical connections that the pool should contain. 0 (zero) indicates no maximum size.
See Also:
setMaxPoolSize(int)

setMaxIdleTime

public void setMaxIdleTime(int maxIdleTime)
Set the number of seconds that a physical connection should remain unused in the pool before the connection is closed.

i-net PLEXA(tm) and the method getConnection() use this property.

Parameters:
maxIdleTime - the number of seconds that a physical connection should remain unused in the pool before the connection is closed. 0 (zero) indicates no limit.
See Also:
getMaxIdleTime(), PoolManager.setMaxIdleTime(int)

getMaxIdleTime

public int getMaxIdleTime()
Get the number of seconds that a physical connection should remain unused in the pool before the connection is closed.

Returns:
the number of seconds that a physical connection should remain unused in the pool before the connection is closed. 0 (zero) indicates no limit.
See Also:
setMaxIdleTime(int)

setPropertyCycle

public void setPropertyCycle(int propertyCycle)
Set the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the above connection pool properties.

An application server managing a pool of PooledConnection objects uses these properties to determine how to manage its pool. i-net PLEXA(tm) and the method getConnection() do not use this property.

Parameters:
propertyCycle - the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the above connection pool properties.
See Also:
getPropertyCycle()

getPropertyCycle

public int getPropertyCycle()
Get the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the above connection pool properties.

Returns:
the interval, in seconds, that the pool should wait before enforcing the current policy defined by the values of the above connection pool properties.
See Also:
setPropertyCycle(int)

setUseDefaultFailoverListener

public void setUseDefaultFailoverListener(boolean useDefaultFailoverListener)
Sets the property useDefaultFailoverListener. This is a method for MonitoredFailover configuration.

Parameters:
useDefaultFailoverListener - the value for the property useDefaultFailoverListener.

setWaitTimeToNextAttempt

public void setWaitTimeToNextAttempt(int waitTimeToNextAttempt)
Sets the property waitTimeToNextAttempt. This is a method for MonitoredFailover configuration.

Parameters:
waitTimeToNextAttempt - the value for the property waitTimeToNextAttempt.

setTotalTimeOfAttempts

public void setTotalTimeOfAttempts(int totalTimeOfAttempts)
Sets the property totalTimeOfAttempts. This is a method for MonitoredFailover configuration.

Parameters:
totalTimeOfAttempts - the value for the property totalTimeOfAttempts.

setFailoverListener

public void setFailoverListener(java.lang.String failoverListener)
Sets the property failoverListener. This is a method for MonitoredFailover configuration.
The set class have to implement the com.inet.pool.FailoverListener

Parameters:
failoverListener - the value for the property failoverListener.

getUseDefaultFailoverListener

public boolean getUseDefaultFailoverListener()
Returns the value of the property useDefaultFailoverListener.

Returns:
the value of the property useDefaultFailoverListener.

getWaitTimeToNextAttempt

public int getWaitTimeToNextAttempt()
Returns the value of the property waitTimeToNextAttempt.

Returns:
the value of the property waitTimeToNextAttempt.

getTotalTimeOfAttempts

public int getTotalTimeOfAttempts()
Returns the value of the property totalTimeOfAttempts.

Returns:
the value of the property totalTimeOfAttempts.

getFailoverListener

public java.lang.String getFailoverListener()
Returns the value of the property failoverListener.

Returns:
the value of the property failoverListener.

i-net DB2 drivers


copyright by i-net software