com.jnetdirect.jsql
Class JSQLDataSource

java.lang.Object
  extended by com.jnetdirect.datasource.BaseDatasource
      extended by com.jnetdirect.jsql.JSQLDataSource
All Implemented Interfaces:
java.io.Serializable, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.DataSource
Direct Known Subclasses:
JSQLConnectionPoolDataSource

public class JSQLDataSource
extends BaseDatasource
implements javax.sql.DataSource

This datasource lists properties specific for the JSQLConect driver. This datasource also supports all commonly used properties such as serverName, databaseName. Please see the documentation for BaseDatasource for additional information.

Since:
1.0
Author:
David Murphy
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jnetdirect.datasource.BaseDatasource
debugLog
 
Constructor Summary
JSQLDataSource()
          Create a new datasource
 
Method Summary
 java.lang.String getApplicationName()
          Get the application name property.
 java.lang.String getAsciiStringParameters()
          Get the ascii setting
 java.lang.String getBooleanLiterals()
          Get the boolean literals property.
 java.lang.String getCodepage()
          Get the codepage
 java.sql.Connection getConnection()
          Obtain a database connection using the datasource user and password properties.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          Obtain a database connection using the supplied user and password properties.
 java.lang.String getConnectionRetryCount()
          Get the connection retry count.
 java.lang.String getConnectionRetryWait()
          Get the connection retry wait time.
 java.lang.String getDisableStatementPooling()
          Get the prepared statement pooling flag.
 java.lang.String getDomain()
          Get the domain name
 java.lang.String getEnableFailover()
          Get the failover enabled mode.
 java.lang.String getInstanceName()
          Get the instance name.
 java.lang.String getIterativeBatching()
          Get the iterativeBatching setting.
 java.lang.String getLastUpdateCount()
          Get the last update count mode.
 java.lang.String getLockTimeout()
          Get the lock timeout
 java.lang.String getNetLibType()
          Get the netLibType (oledb or sqlncli)
 int getPacketSize()
          Get the packetSize
 java.lang.String getPreExecuteMetaData()
          Get the preExecuteMetaData setting..
 java.lang.String getSelectMethod()
          Get the select method setting.
 java.lang.String getSqlVersion()
          Get the SQL version
 java.lang.String getSsl()
          Get the ssl setting
 java.lang.String getSslTrusted()
          Get the ssl validating setting
 java.lang.String getTrustedAuthentication()
          Get the trusted authentication setting.
 int getTrustedAuthenticationPort()
          Get the port used for trusted authentication proxy listener.
 java.lang.String getXopenStates()
          Get the SQL state mode.
 boolean isWrapperFor(java.lang.Class iface)
           
 void setApplicationName(java.lang.String way)
          Set application name.
 void setAsciiStringParameters(java.lang.String way)
          Set ascii string parameters for prepared statements.
 void setBooleanLiterals(java.lang.String way)
          Set boolean literals.
 void setCodepage(java.lang.String codepage)
          Set the code page for the connection.
 void setConnectionRetryCount(java.lang.String retries)
          Enable retries for failed connections.
 void setConnectionRetryWait(java.lang.String waitTime)
          Set the retry period for connection retries in milliseconds.
 void setDisableStatementPooling(java.lang.String way)
          Disable the pooling of prepared statements.
 void setDomain(java.lang.String domain)
          Set the domain name.
 void setEnableFailover(java.lang.String way)
          Enable failover connection property parsing.
 void setInstanceName(java.lang.String instanceName)
          Set the instance name.
 void setIterativeBatching(java.lang.String way)
          Set to true causes the driver to send each command in the batch separately.
 void setLastUpdateCount(java.lang.String way)
          Set the last update count mode.
 void setLockTimeout(int milliSeconds)
          Set the lock timeout.
 void setNetLibType(java.lang.String netLibType)
          Set the Net Lib Type
 void setPacketSize(int packetSize)
          Set the requested packet size
 void setPreExecuteMetaData(java.lang.String way)
          Set to true causes the driver to obtain result set meta data before executing a query.
 void setSelectMethod(java.lang.String way)
          Sets the cursor type for result set.
 void setSqlVersion(java.lang.String version)
          Set the version of SQL Server.
 void setSsl(java.lang.String way)
          Set ssl setting for connections.
 void setSslTrusted(java.lang.String way)
          Set the ssl trusted for connections.
 void setTrustedAuthentication(java.lang.String way)
          Enabled trusted authentication (NT) authentication.
 void setTrustedAuthenticationPort(int portNumber)
          Set the port used for trusted authentication proxy listener.
 void setXopenStates(java.lang.String way)
          Set the SQL state mode.
 java.lang.Object unwrap(java.lang.Class iface)
           
 
Methods inherited from class com.jnetdirect.datasource.BaseDatasource
getConnectionVerifyTable, getDatabase, getDatabaseName, getDescription, getInitialPoolSize, getLogfile, getLoginTimeout, getLogWriter, getManagementCycleTime, getMaxConnectionBacklog, getMaxIdleTime, getMaxPoolSize, getMinPoolSize, getPassword, getPortNumber, getProperties, getPropertyCycle, getReference, getServerName, getUrl, getURL, getUser, setConnectionVerifyTable, setDatabase, setDatabaseName, setDescription, setInitialPoolSize, setLogfile, setLoginTimeout, setLogWriter, setManagementCycleTime, setMaxConnectionBacklog, setMaxIdleTime, setMaxPoolSize, setMinPoolSize, setPassword, setPortNumber, setProperties, setProperty, setPropertyCycle, setServerName, setUrl, setURL, setUser
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 

Constructor Detail

JSQLDataSource

public JSQLDataSource()
Create a new datasource

Method Detail

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Description copied from class: BaseDatasource
Obtain a database connection using the supplied user and password properties. The supplied username and password will override any username or password set as datasource properties.

Specified by:
getConnection in interface javax.sql.DataSource
Overrides:
getConnection in class BaseDatasource
Parameters:
username - The user name for the connection
password - The password for the connection
Returns:
A new JDBC Connection
Throws:
java.sql.SQLException - The database connection failed.

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Description copied from class: BaseDatasource
Obtain a database connection using the datasource user and password properties.

Specified by:
getConnection in interface javax.sql.DataSource
Overrides:
getConnection in class BaseDatasource
Returns:
A new JDBC connection
Throws:
java.sql.SQLException - The database connection failed.

setDisableStatementPooling

public void setDisableStatementPooling(java.lang.String way)
Disable the pooling of prepared statements. Prepared statements will be pooled by default.

Parameters:
way - '1' or 'true' to disable statement pooling

getDisableStatementPooling

public java.lang.String getDisableStatementPooling()
Get the prepared statement pooling flag.

Returns:
The setting of the disable pre prepare flag

setTrustedAuthentication

public void setTrustedAuthentication(java.lang.String way)
Enabled trusted authentication (NT) authentication. The credentials of the user's account will be used for database connection authentication. No username or password is required for the connection. SQL Server must be enabled for trusted (NT) authentication and your NT credentials must be defined in the target SQL Server instance as a trusted account.

Parameters:
way - '1' or 'true' to enable trusted authentication

getTrustedAuthentication

public java.lang.String getTrustedAuthentication()
Get the trusted authentication setting.

Returns:
The setting of trusted authentication

setSelectMethod

public void setSelectMethod(java.lang.String way)
Sets the cursor type for result set. This property is useful when you are dealing with large result sets and don't want to store the whole result set in memory on the client side. By setting the property to "cursor" you will be able to create a server side cursor and can get chunks of data at a time.

Parameters:
way - 'cursor' to enable select method.

getSelectMethod

public java.lang.String getSelectMethod()
Get the select method setting.

Returns:
The setting of select method.

setPreExecuteMetaData

public void setPreExecuteMetaData(java.lang.String way)
Set to true causes the driver to obtain result set meta data before executing a query. When this setting is on the application may call PreparedStatement.getMetaData() before executing a query. This setting is also required to return LOB objects from the driver.

Parameters:
way - '1' or 'true' to enable preExecuteMetaData

getPreExecuteMetaData

public java.lang.String getPreExecuteMetaData()
Get the preExecuteMetaData setting..

Returns:
The setting of preExecuteMetaData.

setIterativeBatching

public void setIterativeBatching(java.lang.String way)
Set to true causes the driver to send each command in the batch separately. If a command fails, then all the remaining commands are not processed. The default (false) will result in the continuation of processing beyond the point of failure. Also the performance in this case would be lot better. Set to true to guarantee compatibility with JSQLConnect 3.0 or 2.0.


getIterativeBatching

public java.lang.String getIterativeBatching()
Get the iterativeBatching setting.

Returns:
The setting of iterativeBatching

setSqlVersion

public void setSqlVersion(java.lang.String version)
Set the version of SQL Server. Set to 6 only if using SQL Server 6.5.


getSqlVersion

public java.lang.String getSqlVersion()
Get the SQL version


setCodepage

public void setCodepage(java.lang.String codepage)
Set the code page for the connection. Required if character data is not stored in double byte characters and the code page of the client is different than the code page of the database.

Parameters:
codepage - the character set code page

getCodepage

public java.lang.String getCodepage()
Get the codepage


setLockTimeout

public void setLockTimeout(int milliSeconds)
Set the lock timeout. The number of milliseconds to wait before the database reports a lock timeout. The default behavior is to wait forever. If specified, this value will be the default for all statements on the connection. Note that Statement.setQueryTimeout() may be used to set the timeout for specific statements. The value may be 0 which specifies no wait.

Parameters:
milliSeconds - The number of milliseconds to wait.

getLockTimeout

public java.lang.String getLockTimeout()
Get the lock timeout


setAsciiStringParameters

public void setAsciiStringParameters(java.lang.String way)
Set ascii string parameters for prepared statements. Set to "1" or "true" to specify that prepared parameters for character data are sent as ASCII rather than UNICODE. This parameter can improve performance for character data index lookup on non-Unicode, SQL Server 2000 tables. For example, ASCII row keys can be compared directly without the overhead of conversion from UNICODE. For more information, see Microsoft's discussion at - http://support.microsoft.com/default.aspx?scid=kb;en-us;Q271566

Parameters:
-

getAsciiStringParameters

public java.lang.String getAsciiStringParameters()
Get the ascii setting


setBooleanLiterals

public void setBooleanLiterals(java.lang.String way)
Set boolean literals. The driver will interpret 'true' as 1 and 'false' as 0. The default is off. This translation is available to allow portability of code between databases that support the boolean datatype. Boolean literals can be mapped to the numeric SQL Server bit field using this property.

Parameters:
set - way to 'true' or '1' to enable the translation.

getBooleanLiterals

public java.lang.String getBooleanLiterals()
Get the boolean literals property.


setApplicationName

public void setApplicationName(java.lang.String way)
Set application name. Used to identify the specific application in various SQL Server profiling and logging tools. This property is useful to differentiate profiling activity on various connections.

Parameters:
The - application name.

getApplicationName

public java.lang.String getApplicationName()
Get the application name property.


setLastUpdateCount

public void setLastUpdateCount(java.lang.String way)
Set the last update count mode. Set on to have the driver return only the last update count. For example, this property may be used if update counts from triggers should not be returned to the application. The default is to return all update counts.

Parameters:
way - Set to "1" or "true" to enable this mode.

getLastUpdateCount

public java.lang.String getLastUpdateCount()
Get the last update count mode.


setInstanceName

public void setInstanceName(java.lang.String instanceName)
Set the instance name. The default is to connect to the default instance.

Parameters:
instanceName - The instance name.

getInstanceName

public java.lang.String getInstanceName()
Get the instance name.


setXopenStates

public void setXopenStates(java.lang.String way)
Set the SQL state mode. Set on to have the driver return SQL states as XOPEN compliant. The default is false which causes the driver to generates SQL 99 state codes.

Parameters:
way - Set to "1" or "true" to enable XOPEN mode.

getXopenStates

public java.lang.String getXopenStates()
Get the SQL state mode.


setEnableFailover

public void setEnableFailover(java.lang.String way)
Enable failover connection property parsing. The default is false.

Parameters:
way - Set to "true" to enable failover mode.

getEnableFailover

public java.lang.String getEnableFailover()
Get the failover enabled mode.


setConnectionRetryCount

public void setConnectionRetryCount(java.lang.String retries)
Enable retries for failed connections. Connections will be retried when a connection attempt fails. The default is zero retries.

Parameters:
retries - Set to the number of retries.

getConnectionRetryCount

public java.lang.String getConnectionRetryCount()
Get the connection retry count.


setConnectionRetryWait

public void setConnectionRetryWait(java.lang.String waitTime)
Set the retry period for connection retries in milliseconds. Only applicable if connectionRetryCount is > 0. The default is 100 milliseconds.

Parameters:
waitTime - Set to the number of milliseconds.

getConnectionRetryWait

public java.lang.String getConnectionRetryWait()
Get the connection retry wait time.


setTrustedAuthenticationPort

public void setTrustedAuthenticationPort(int portNumber)
Set the port used for trusted authentication proxy listener.

Parameters:
portNumber - Set to the port used for Trusted Authentication Proxy listener.

getTrustedAuthenticationPort

public int getTrustedAuthenticationPort()
Get the port used for trusted authentication proxy listener.


setDomain

public void setDomain(java.lang.String domain)
Set the domain name.

Parameters:
domain - Sets the domain name.

getDomain

public java.lang.String getDomain()
Get the domain name


setSsl

public void setSsl(java.lang.String way)
Set ssl setting for connections. Set to "auto" to enable ssl connections if the database supports them Set to "mandatory" to require ssl connections always

Parameters:
-

getSsl

public java.lang.String getSsl()
Get the ssl setting


setSslTrusted

public void setSslTrusted(java.lang.String way)
Set the ssl trusted for connections. Set to "true" to have the driver certify the database's certificate is trusted. Set to "false" means the database's certificate is not checked to be trusted.

Parameters:
-

getSslTrusted

public java.lang.String getSslTrusted()
Get the ssl validating setting


setPacketSize

public void setPacketSize(int packetSize)
Set the requested packet size

Parameters:
packetSize - Set to the requested packetSize

getPacketSize

public int getPacketSize()
Get the packetSize


setNetLibType

public void setNetLibType(java.lang.String netLibType)
Set the Net Lib Type

Parameters:
netLibType - (oledb or sqlncli)

getNetLibType

public java.lang.String getNetLibType()
Get the netLibType (oledb or sqlncli)


isWrapperFor

public boolean isWrapperFor(java.lang.Class iface)
                     throws java.sql.SQLException
Specified by:
isWrapperFor in interface java.sql.Wrapper
Throws:
java.sql.SQLException

unwrap

public java.lang.Object unwrap(java.lang.Class iface)
                        throws java.sql.SQLException
Specified by:
unwrap in interface java.sql.Wrapper
Throws:
java.sql.SQLException