i-net JDBC drivers for MS SQL Server

com.inet.tds
Class PDataSource

java.lang.Object
  extended by com.inet.tds.TdsDriver
      extended by com.inet.tds.TdsDataSource
          extended by com.inet.tds.PDataSource
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Runnable, java.sql.Driver, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource
Direct Known Subclasses:
PDataSource4

public class PDataSource
extends TdsDataSource
implements javax.sql.ConnectionPoolDataSource

This class is the implementation of the ConnectionPoolDataSource in the driver i-net OPTA-xs and MERLIA-xs. A sample can be found in the file sample/WithPoolDataSource.java.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.inet.tds.TdsDataSource
MODE_SQLSERVER_65, MODE_SQLSERVER_70, MODE_SQLSERVER_70_ASCII
 
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. 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 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. 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.tds.TdsDataSource
clone, getAppname, getCharset, getDatabaseName, getDescription, getDstsave, getFailover, getFailoverInstanceName, getFailoverPort, getFailoverServerName, getFetchsize, getFulltran, getImpltran, getInitSQL, getInstanceName, getJAVA_OBJECT, getLanguage, getLastUpdateCount, getLoginTimeout, getLogWriter, getMode, getPacketSize, getPassword, getPort, getPortNumber, getPrepare, getPrepareLiveTime, getProperties, getProperty, getQueryTimeout, getReference, getResultSetType, getSecureLevel, getServerName, getSqlServer7Mode, getStatusRequest, getUrl, getUseCursorsAlways, getUseInsteadOfTrigger, getUser, getWSID, isMars, setAppname, setCharset, setDatabaseName, setDescription, setDstsave, setFailover, setFailoverInstanceName, setFailoverPort, setFailoverServerName, setFetchsize, setFulltran, setFulltran, setImpltran, setImpltran, setInitSQL, setInstanceName, setJAVA_OBJECT, setLanguage, setLastUpdateCount, setLogging, setLoginTimeout, setLogWriter, setMars, setMode, setPacketSize, setPassword, setPort, setPortNumber, setPrepare, setPrepareLiveTime, setProperties, setProperty, setProperty, setProperty, setQueryTimeout, setResultSetType, setSecureLevel, setServerName, setSqlServer7Mode, setStatusRequest, setUrl, setUseCursorsAlways, setUseInsteadOfTrigger, setUser, setWSID, toString
 
Methods inherited from class com.inet.tds.TdsDriver
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.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

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 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 TdsDataSource
Returns:
a connection from a pool
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
TdsDataSource.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 TdsDataSource
Parameters:
username -
password -
Returns:
a connection from a pool
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
TdsDataSource.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. 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 TdsDataSource
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 MS SQL Server


copyright by i-net software