net.sourceforge.jtds.jdbcx
Class JtdsDataSource

java.lang.Object
  extended bynet.sourceforge.jtds.jdbcx.JtdsDataSource
All Implemented Interfaces:
javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, javax.naming.Referenceable, java.io.Serializable, javax.sql.XADataSource

public class JtdsDataSource
extends java.lang.Object
implements javax.sql.DataSource, javax.sql.ConnectionPoolDataSource, javax.sql.XADataSource, javax.naming.Referenceable, java.io.Serializable

The jTDS DataSource, ConnectionPoolDataSource and XADataSource implementation.

Since:
jTDS 0.3
Author:
Alin Sinplean, Holger Rehn
See Also:
Serialized Form

Field Summary
private  java.util.HashMap _Config
           
private static Driver _Driver
          Driver instance used for obtaining connections.
(package private) static java.lang.String DESCRIPTION
           
(package private) static long serialVersionUID
          serial version UID
 
Constructor Summary
  JtdsDataSource()
          Constructs a new DataSource.
(package private) JtdsDataSource(java.util.HashMap config)
          Constructs a configured DataSource.
 
Method Summary
private  void addNonNullProperties(java.util.Properties props, java.lang.String user, java.lang.String password)
           
 java.lang.String getAppName()
           
 boolean getAutoCommit()
           
 int getBatchSize()
           
 java.lang.String getBindAddress()
           
 java.lang.String getBufferDir()
           
 int getBufferMaxMemory()
           
 int getBufferMinPackets()
           
 boolean getCacheMetaData()
           
 java.lang.String getCharset()
           
 java.sql.Connection getConnection()
          Returns a new database connection.
 java.sql.Connection getConnection(java.lang.String user, java.lang.String password)
          Returns a new database connection for the user and password specified.
 java.lang.String getDatabaseName()
           
 java.lang.String getDescription()
           
 java.lang.String getDomain()
           
 java.lang.String getInstance()
           
private  int getIntProperty(java.lang.String key)
           
 java.lang.String getLanguage()
           
 boolean getLastUpdateCount()
           
 long getLobBuffer()
           
 java.lang.String getLogFile()
           
 int getLoginTimeout()
           
 java.io.PrintWriter getLogWriter()
           
private  long getLongProperty(java.lang.String key)
           
 java.lang.String getMacAddress()
           
 int getMaxStatements()
           
 boolean getNamedPipe()
           
 int getPacketSize()
           
 java.lang.String getPassword()
           
 javax.sql.PooledConnection getPooledConnection()
          Returns a new pooled database connection.
 javax.sql.PooledConnection getPooledConnection(java.lang.String user, java.lang.String password)
          Returns a new pooled database connection for the user and password specified.
 int getPortNumber()
           
 int getPrepareSql()
           
 java.lang.String getProcessId()
           
 java.lang.String getProgName()
           
 javax.naming.Reference getReference()
           
 boolean getSendStringParametersAsUnicode()
           
 java.lang.String getServerName()
           
 int getServerType()
           
 boolean getSocketKeepAlive()
           
 int getSocketTimeout()
           
 java.lang.String getSsl()
           
 boolean getTcpNoDelay()
           
 java.lang.String getTds()
           
 boolean getUseCursors()
           
 boolean getUseJCIFS()
           
 boolean getUseLOBs()
           
 boolean getUseNTLMV2()
           
 java.lang.String getUser()
           
 java.lang.String getWsid()
           
 javax.sql.XAConnection getXAConnection()
          Returns a new XA database connection.
 javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String password)
          Returns a new XA database connection for the user and password specified.
 boolean getXaEmulation()
           
 void setAppName(java.lang.String appName)
           
 void setAutoCommit(boolean autoCommit)
           
 void setBatchSize(int batchSize)
           
 void setBindAddress(java.lang.String bindAddress)
           
 void setBufferDir(java.lang.String bufferDir)
           
 void setBufferMaxMemory(int bufferMaxMemory)
           
 void setBufferMinPackets(int bufferMinPackets)
           
 void setCacheMetaData(boolean cacheMetaData)
           
 void setCharset(java.lang.String charset)
           
 void setDatabaseName(java.lang.String databaseName)
           
 void setDescription(java.lang.String description)
           
 void setDomain(java.lang.String domain)
           
 void setInstance(java.lang.String instance)
           
 void setLanguage(java.lang.String language)
           
 void setLastUpdateCount(boolean lastUpdateCount)
           
 void setLobBuffer(long lobBuffer)
           
 void setLogFile(java.lang.String logFile)
           
 void setLoginTimeout(int loginTimeout)
           
 void setLogWriter(java.io.PrintWriter out)
           
 void setMacAddress(java.lang.String macAddress)
           
 void setMaxStatements(int maxStatements)
           
 void setNamedPipe(boolean namedPipe)
           
 void setPacketSize(int packetSize)
           
 void setPassword(java.lang.String password)
           
 void setPortNumber(int portNumber)
           
 void setPrepareSql(int prepareSql)
           
 void setProcessId(java.lang.String processId)
           
 void setProgName(java.lang.String progName)
           
 void setSendStringParametersAsUnicode(boolean sendStringParametersAsUnicode)
           
 void setServerName(java.lang.String serverName)
           
 void setServerType(int serverType)
           
 void setSocketKeepAlive(boolean socketKeepAlive)
           
 void setSocketTimeout(int socketTimeout)
           
 void setSsl(java.lang.String ssl)
           
 void setTcpNoDelay(boolean tcpNoDelay)
           
 void setTds(java.lang.String tds)
           
 void setUseCursors(boolean useCursors)
           
 void setUseJCIFS(boolean useJCIFS)
           
 void setUseLOBs(boolean useLOBs)
           
 void setUseNTLMV2(boolean usentlmv2)
           
 void setUser(java.lang.String user)
           
 void setWsid(java.lang.String wsid)
           
 void setXaEmulation(boolean xaEmulation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
serial version UID

See Also:
Constant Field Values

DESCRIPTION

static final java.lang.String DESCRIPTION
See Also:
Constant Field Values

_Config

private final java.util.HashMap _Config

_Driver

private static final Driver _Driver
Driver instance used for obtaining connections.

Constructor Detail

JtdsDataSource

JtdsDataSource(java.util.HashMap config)
Constructs a configured DataSource.


JtdsDataSource

public JtdsDataSource()
Constructs a new DataSource.

Method Detail

getXAConnection

public javax.sql.XAConnection getXAConnection()
                                       throws java.sql.SQLException
Returns a new XA database connection.

Specified by:
getXAConnection in interface javax.sql.XADataSource
Returns:
a new database connection
Throws:
java.sql.SQLException - if an error occurs

getXAConnection

public javax.sql.XAConnection getXAConnection(java.lang.String user,
                                              java.lang.String password)
                                       throws java.sql.SQLException
Returns a new XA database connection for the user and password specified.

Specified by:
getXAConnection in interface javax.sql.XADataSource
Parameters:
user - the user name to connect with
password - the password to connect with
Returns:
a new database connection
Throws:
java.sql.SQLException - if an error occurs

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns a new database connection.

Specified by:
getConnection in interface javax.sql.DataSource
Returns:
a new database connection
Throws:
java.sql.SQLException - if an error occurs

getConnection

public java.sql.Connection getConnection(java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Returns a new database connection for the user and password specified.

Specified by:
getConnection in interface javax.sql.DataSource
Parameters:
user - the user name to connect with
password - the password to connect with
Returns:
a new database connection
Throws:
java.sql.SQLException - if an error occurs

getReference

public javax.naming.Reference getReference()
Specified by:
getReference in interface javax.naming.Referenceable

getPooledConnection

public javax.sql.PooledConnection getPooledConnection()
                                               throws java.sql.SQLException
Returns a new pooled database connection.

Specified by:
getPooledConnection in interface javax.sql.ConnectionPoolDataSource
Returns:
a new pooled database connection
Throws:
java.sql.SQLException - if an error occurs

getPooledConnection

public javax.sql.PooledConnection getPooledConnection(java.lang.String user,
                                                      java.lang.String password)
                                               throws java.sql.SQLException
Returns a new pooled database connection for the user and password specified.

Specified by:
getPooledConnection in interface javax.sql.ConnectionPoolDataSource
Parameters:
user - the user name to connect with
password - the password to connect with
Returns:
a new pooled database connection
Throws:
java.sql.SQLException - if an error occurs

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
Specified by:
setLogWriter in interface javax.sql.DataSource

getLogWriter

public java.io.PrintWriter getLogWriter()
Specified by:
getLogWriter in interface javax.sql.DataSource

setLoginTimeout

public void setLoginTimeout(int loginTimeout)
Specified by:
setLoginTimeout in interface javax.sql.DataSource

getLoginTimeout

public int getLoginTimeout()
Specified by:
getLoginTimeout in interface javax.sql.DataSource

setSocketTimeout

public void setSocketTimeout(int socketTimeout)

getSocketTimeout

public int getSocketTimeout()

setSocketKeepAlive

public void setSocketKeepAlive(boolean socketKeepAlive)

getSocketKeepAlive

public boolean getSocketKeepAlive()

setProcessId

public void setProcessId(java.lang.String processId)

getProcessId

public java.lang.String getProcessId()

setDatabaseName

public void setDatabaseName(java.lang.String databaseName)

getDatabaseName

public java.lang.String getDatabaseName()

setDescription

public void setDescription(java.lang.String description)

getDescription

public java.lang.String getDescription()

setPassword

public void setPassword(java.lang.String password)

getPassword

public java.lang.String getPassword()

setPortNumber

public void setPortNumber(int portNumber)

getPortNumber

public int getPortNumber()

setServerName

public void setServerName(java.lang.String serverName)

getServerName

public java.lang.String getServerName()

setAutoCommit

public void setAutoCommit(boolean autoCommit)

getAutoCommit

public boolean getAutoCommit()

setUser

public void setUser(java.lang.String user)

getUser

public java.lang.String getUser()

setTds

public void setTds(java.lang.String tds)

getTds

public java.lang.String getTds()

setServerType

public void setServerType(int serverType)

getServerType

public int getServerType()

setDomain

public void setDomain(java.lang.String domain)

getDomain

public java.lang.String getDomain()

setUseNTLMV2

public void setUseNTLMV2(boolean usentlmv2)

getUseNTLMV2

public boolean getUseNTLMV2()

setInstance

public void setInstance(java.lang.String instance)

getInstance

public java.lang.String getInstance()

setSendStringParametersAsUnicode

public void setSendStringParametersAsUnicode(boolean sendStringParametersAsUnicode)

getSendStringParametersAsUnicode

public boolean getSendStringParametersAsUnicode()

setNamedPipe

public void setNamedPipe(boolean namedPipe)

getNamedPipe

public boolean getNamedPipe()

setLastUpdateCount

public void setLastUpdateCount(boolean lastUpdateCount)

getLastUpdateCount

public boolean getLastUpdateCount()

setXaEmulation

public void setXaEmulation(boolean xaEmulation)

getXaEmulation

public boolean getXaEmulation()

setCharset

public void setCharset(java.lang.String charset)

getCharset

public java.lang.String getCharset()

setLanguage

public void setLanguage(java.lang.String language)

getLanguage

public java.lang.String getLanguage()

setMacAddress

public void setMacAddress(java.lang.String macAddress)

getMacAddress

public java.lang.String getMacAddress()

setPacketSize

public void setPacketSize(int packetSize)

getPacketSize

public int getPacketSize()

setTcpNoDelay

public void setTcpNoDelay(boolean tcpNoDelay)

getTcpNoDelay

public boolean getTcpNoDelay()

setPrepareSql

public void setPrepareSql(int prepareSql)

getPrepareSql

public int getPrepareSql()

setLobBuffer

public void setLobBuffer(long lobBuffer)

getLobBuffer

public long getLobBuffer()

setMaxStatements

public void setMaxStatements(int maxStatements)

getMaxStatements

public int getMaxStatements()

setAppName

public void setAppName(java.lang.String appName)

getAppName

public java.lang.String getAppName()

setProgName

public void setProgName(java.lang.String progName)

getProgName

public java.lang.String getProgName()

setWsid

public void setWsid(java.lang.String wsid)

getWsid

public java.lang.String getWsid()

setLogFile

public void setLogFile(java.lang.String logFile)

getLogFile

public java.lang.String getLogFile()

setSsl

public void setSsl(java.lang.String ssl)

getSsl

public java.lang.String getSsl()

setBatchSize

public void setBatchSize(int batchSize)

getBatchSize

public int getBatchSize()

setBufferDir

public void setBufferDir(java.lang.String bufferDir)

getBufferDir

public java.lang.String getBufferDir()

getBufferMaxMemory

public int getBufferMaxMemory()

setBufferMaxMemory

public void setBufferMaxMemory(int bufferMaxMemory)

setBufferMinPackets

public void setBufferMinPackets(int bufferMinPackets)

getBufferMinPackets

public int getBufferMinPackets()

setCacheMetaData

public void setCacheMetaData(boolean cacheMetaData)

getCacheMetaData

public boolean getCacheMetaData()

setUseCursors

public void setUseCursors(boolean useCursors)

getUseCursors

public boolean getUseCursors()

setUseLOBs

public void setUseLOBs(boolean useLOBs)

getUseLOBs

public boolean getUseLOBs()

setBindAddress

public void setBindAddress(java.lang.String bindAddress)

getBindAddress

public java.lang.String getBindAddress()

setUseJCIFS

public void setUseJCIFS(boolean useJCIFS)

getUseJCIFS

public boolean getUseJCIFS()

addNonNullProperties

private void addNonNullProperties(java.util.Properties props,
                                  java.lang.String user,
                                  java.lang.String password)

getIntProperty

private int getIntProperty(java.lang.String key)

getLongProperty

private long getLongProperty(java.lang.String key)


Generated on October 27 2012