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
    Version:
    $Id: JtdsDataSource.java,v 1.42.2.4 2009/12/30 08:45:34 ickzon Exp $
    Author:
    Alin Sinplean
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        static final long serialVersionUID
        Serial version UID.
        See Also:
        Constant Field Values
      • serverName

        protected java.lang.String serverName
      • serverType

        protected java.lang.String serverType
      • portNumber

        protected java.lang.String portNumber
      • databaseName

        protected java.lang.String databaseName
      • tdsVersion

        protected java.lang.String tdsVersion
      • charset

        protected java.lang.String charset
      • language

        protected java.lang.String language
      • domain

        protected java.lang.String domain
      • useNTLMV2

        protected java.lang.String useNTLMV2
      • instance

        protected java.lang.String instance
      • lastUpdateCount

        protected java.lang.String lastUpdateCount
      • sendStringParametersAsUnicode

        protected java.lang.String sendStringParametersAsUnicode
      • namedPipe

        protected java.lang.String namedPipe
      • macAddress

        protected java.lang.String macAddress
      • prepareSql

        protected java.lang.String prepareSql
      • packetSize

        protected java.lang.String packetSize
      • tcpNoDelay

        protected java.lang.String tcpNoDelay
      • user

        protected java.lang.String user
      • password

        protected java.lang.String password
      • loginTimeout

        protected java.lang.String loginTimeout
      • lobBuffer

        protected java.lang.String lobBuffer
      • maxStatements

        protected java.lang.String maxStatements
      • appName

        protected java.lang.String appName
      • progName

        protected java.lang.String progName
      • wsid

        protected java.lang.String wsid
      • xaEmulation

        protected java.lang.String xaEmulation
      • logFile

        protected java.lang.String logFile
      • socketTimeout

        protected java.lang.String socketTimeout
      • socketKeepAlive

        protected java.lang.String socketKeepAlive
      • processId

        protected java.lang.String processId
      • ssl

        protected java.lang.String ssl
      • batchSize

        protected java.lang.String batchSize
      • bufferDir

        protected java.lang.String bufferDir
      • bufferMaxMemory

        protected java.lang.String bufferMaxMemory
      • bufferMinPackets

        protected java.lang.String bufferMinPackets
      • cacheMetaData

        protected java.lang.String cacheMetaData
      • useCursors

        protected java.lang.String useCursors
      • useLOBs

        protected java.lang.String useLOBs
      • bindAddress

        protected java.lang.String bindAddress
      • useJCIFS

        protected java.lang.String useJCIFS
      • description

        protected java.lang.String description
      • driver

        private static final Driver driver
        Driver instance used for obtaining connections.
    • Constructor Detail

      • 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()
                                            throws javax.naming.NamingException
        Specified by:
        getReference in interface javax.naming.Referenceable
        Throws:
        javax.naming.NamingException
      • 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
      • getLogWriter

        public java.io.PrintWriter getLogWriter()
                                         throws java.sql.SQLException
        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
        Throws:
        java.sql.SQLException
      • setLogWriter

        public void setLogWriter​(java.io.PrintWriter out)
                          throws java.sql.SQLException
        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
        Throws:
        java.sql.SQLException
      • setLoginTimeout

        public void setLoginTimeout​(int loginTimeout)
                             throws java.sql.SQLException
        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
        Throws:
        java.sql.SQLException
      • getLoginTimeout

        public int getLoginTimeout()
                            throws java.sql.SQLException
        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
        Throws:
        java.sql.SQLException
      • setSocketTimeout

        public void setSocketTimeout​(int socketTimeout)
                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setSocketKeepAlive

        public void setSocketKeepAlive​(boolean socketKeepAlive)
                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setProcessId

        public void setProcessId​(java.lang.String processId)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getSocketTimeout

        public int getSocketTimeout()
                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getSocketKeepAlive

        public boolean getSocketKeepAlive()
                                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getProcessId

        public java.lang.String getProcessId()
                                      throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • 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()
      • 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()
      • getDomain

        public java.lang.String getDomain()
      • setDomain

        public void setDomain​(java.lang.String domain)
      • getUseNTLMV2

        public java.lang.String getUseNTLMV2()
      • setUseNTLMV2

        public void setUseNTLMV2​(java.lang.String usentlmv2)
      • getInstance

        public java.lang.String getInstance()
      • setInstance

        public void setInstance​(java.lang.String instance)
      • getSendStringParametersAsUnicode

        public boolean getSendStringParametersAsUnicode()
      • setSendStringParametersAsUnicode

        public void setSendStringParametersAsUnicode​(boolean sendStringParametersAsUnicode)
      • getNamedPipe

        public boolean getNamedPipe()
      • setNamedPipe

        public void setNamedPipe​(boolean namedPipe)
      • getLastUpdateCount

        public boolean getLastUpdateCount()
      • setLastUpdateCount

        public void setLastUpdateCount​(boolean lastUpdateCount)
      • getXaEmulation

        public boolean getXaEmulation()
      • setXaEmulation

        public void setXaEmulation​(boolean xaEmulation)
      • getCharset

        public java.lang.String getCharset()
      • setCharset

        public void setCharset​(java.lang.String charset)
      • getLanguage

        public java.lang.String getLanguage()
      • setLanguage

        public void setLanguage​(java.lang.String language)
      • getMacAddress

        public java.lang.String getMacAddress()
      • setMacAddress

        public void setMacAddress​(java.lang.String macAddress)
      • setPacketSize

        public void setPacketSize​(int packetSize)
      • getPacketSize

        public int getPacketSize()
      • getTcpNoDelay

        public boolean getTcpNoDelay()
      • setTcpNoDelay

        public void setTcpNoDelay​(boolean tcpNoDelay)
      • 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()
      • getBufferDir

        public java.lang.String getBufferDir()
      • setBufferDir

        public void setBufferDir​(java.lang.String bufferDir)
      • getBufferMaxMemory

        public int getBufferMaxMemory()
      • setBufferMaxMemory

        public void setBufferMaxMemory​(int bufferMaxMemory)
      • getBufferMinPackets

        public int getBufferMinPackets()
      • setBufferMinPackets

        public void setBufferMinPackets​(int bufferMinPackets)
      • getCacheMetaData

        public boolean getCacheMetaData()
      • setCacheMetaData

        public void setCacheMetaData​(boolean cacheMetaData)
      • getUseCursors

        public boolean getUseCursors()
      • setUseCursors

        public void setUseCursors​(boolean useCursors)
      • getUseLOBs

        public boolean getUseLOBs()
      • setUseLOBs

        public void setUseLOBs​(boolean useLOBs)
      • getBindAddress

        public java.lang.String getBindAddress()
      • setBindAddress

        public void setBindAddress​(java.lang.String bindAddress)
      • getUseJCIFS

        public boolean getUseJCIFS()
      • setUseJCIFS

        public void setUseJCIFS​(boolean useJCIFS)
      • addNonNullProperties

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

        public boolean isWrapperFor​(java.lang.Class arg0)
                             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 arg0)
                                throws java.sql.SQLException
        Specified by:
        unwrap in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • getParentLogger

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