Class JtdsDataSource

  • All Implemented Interfaces:
    java.io.Serializable, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, 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 Detail

      • serialVersionUID

        static final long serialVersionUID
        serial version UID
        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.CommonDataSource
        Specified by:
        setLogWriter in interface javax.sql.ConnectionPoolDataSource
        Specified by:
        setLogWriter in interface javax.sql.DataSource
        Specified by:
        setLogWriter in interface javax.sql.XADataSource
      • getLogWriter

        public java.io.PrintWriter getLogWriter()
        Specified by:
        getLogWriter in interface javax.sql.CommonDataSource
        Specified by:
        getLogWriter in interface javax.sql.ConnectionPoolDataSource
        Specified by:
        getLogWriter in interface javax.sql.DataSource
        Specified by:
        getLogWriter in interface javax.sql.XADataSource
      • setLoginTimeout

        public void setLoginTimeout​(int loginTimeout)
        Specified by:
        setLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        setLoginTimeout in interface javax.sql.ConnectionPoolDataSource
        Specified by:
        setLoginTimeout in interface javax.sql.DataSource
        Specified by:
        setLoginTimeout in interface javax.sql.XADataSource
      • getLoginTimeout

        public int getLoginTimeout()
        Specified by:
        getLoginTimeout in interface javax.sql.CommonDataSource
        Specified by:
        getLoginTimeout in interface javax.sql.ConnectionPoolDataSource
        Specified by:
        getLoginTimeout in interface javax.sql.DataSource
        Specified by:
        getLoginTimeout in interface javax.sql.XADataSource
      • 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()
      • setUseKerberos

        public void setUseKerberos​(boolean useKerberos)
      • getUseKerberos

        public boolean getUseKerberos()
      • 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)
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class arg0)
        Specified by:
        isWrapperFor in interface java.sql.Wrapper
      • unwrap

        public java.lang.Object unwrap​(java.lang.Class arg0)
        Specified by:
        unwrap in interface java.sql.Wrapper
      • getParentLogger

        public java.util.logging.Logger getParentLogger()
                                                 throws java.sql.SQLFeatureNotSupportedException
        Specified by:
        getParentLogger in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLFeatureNotSupportedException