i-net JDBC drivers for Sybase

com.inet.syb
Class PDataSource

java.lang.Object
  extended bycom.inet.syb.SybDriver
      extended bycom.inet.syb.SybDataSource
          extended bycom.inet.syb.PDataSource
All Implemented Interfaces:
java.lang.Cloneable, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, java.sql.Driver, javax.naming.Referenceable, java.lang.Runnable, java.io.Serializable

public class PDataSource
extends SybDataSource
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 SybDataSource.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          override the method in SybDataSource.
 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. 0 (zero) indicates no limit.
 int getMaxPoolSize()
          Get the maximum number of physical connections that the pool should contain. 0 (zero) indicates no maximum size.
 int getMaxStatements()
          Get the total number of statements that the pool should keep open. 0 (zero) indicates that caching of statements is disabled.
 int getMinPoolSize()
          Get the number of physical connections the pool should keep available at all times. 0 (zero) indicates that connections should be created as needed.
 javax.sql.PooledConnection getPooledConnection()
          This method creates a real connection to the Sybase 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 Sybase 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. 0 (zero) indicates no limit.
 void setMaxPoolSize(int maxPoolSize)
          Set the maximum number of physical connections that the pool should contain. 0 (zero) indicates no maximum size.
 void setMaxStatements(int maxStatements)
          Set the total number of statements that the pool should keep open. 0 (zero) indicates that caching of statements is disabled.
 void setMinPoolSize(int minPoolSize)
          Set the number of physical connections the pool should keep available at all times. 0 (zero) indicates that connections should be created as needed.
 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.syb.SybDataSource
clone, getAppname, getChained, getCharset, getDatabaseName, getDescription, getImpltran, getLogging, getLoginTimeout, getLogWriter, getPassword, getPort, getPortNumber, getProperties, getProperty, getReference, getServerName, getUser, setAppname, setChained, setCharset, setDatabaseName, setDescription, setImpltran, setLogging, setLoginTimeout, setLogWriter, setPassword, setPort, setPortNumber, setProperties, setProperty, setProperty, setServerName, setUser, toString
 
Methods inherited from class com.inet.syb.SybDriver
acceptsURL, connect, getMajorVersion, getMinorVersion, getPropertyInfo, jdbcCompliant, run
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sql.ConnectionPoolDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 

Constructor Detail

PDataSource

public PDataSource()
Create an empty DataSource.

Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
override the method in SybDataSource. 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 SybDataSource
Returns:
a connection from a pool
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
SybDataSource.getConnection()

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
override the method in SybDataSource. 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 SybDataSource
Parameters:
username -
password -
Returns:
a connection from a pool
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
SybDataSource.getConnection(String,String)

getPooledConnection

public javax.sql.PooledConnection getPooledConnection()
                                               throws java.sql.SQLException
This method creates a real connection to the Sybase 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 Sybase 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. The result is true if and only if the argument is not null and if it is a PDataSource object that has the same significant properties.

Overrides:
equals in class SybDataSource
Parameters:
obj - the object to compare.

setMaxStatements

public void setMaxStatements(int maxStatements)
Set the total number of statements that the pool should keep open. 0 (zero) indicates that caching of statements is disabled.

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.

See Also:
getMaxStatements()

getMaxStatements

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

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.

See Also:
getInitialPoolSize()

getInitialPoolSize

public int getInitialPoolSize()
Get 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. 0 (zero) indicates that connections should be created as needed.

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

See Also:
getMinPoolSize()

getMinPoolSize

public int getMinPoolSize()
Get 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. 0 (zero) indicates no maximum size.

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

See Also:
getMaxPoolSize(), PoolManager.setMaxPoolSize(int)

getMaxPoolSize

public int getMaxPoolSize()
Get 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. 0 (zero) indicates no limit.

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

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. 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.

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.

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 JDBC drivers for Sybase


copyright by i-net software