Package net.sourceforge.jtds.jdbc
Class Driver
- java.lang.Object
-
- net.sourceforge.jtds.jdbc.Driver
-
- All Implemented Interfaces:
java.sql.Driver
public class Driver extends java.lang.Object implements java.sql.DriverjTDS implementation of the java.sql.Driver interface.Implementation note:
- Property text names and descriptions are loaded from an external file resource. This allows the actual names and descriptions to be changed or localised without impacting this code.
- The way in which the URL is parsed and converted to properties is rather different from the original jTDS Driver class. See parseURL and Connection.unpackProperties methods for more detail.
- Version:
- $Id: Driver.java,v 1.70.2.4 2009-12-30 11:19:40 ickzon Exp $
- Author:
- Brian Heineman, Mike Hutchinson, Alin Sinpalean
- See Also:
Driver
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAPPNAMEstatic java.lang.StringAUTOCOMMITstatic java.lang.StringBATCHSIZEstatic java.lang.StringBINDADDRESSstatic java.lang.StringBUFFERDIRstatic java.lang.StringBUFFERMAXMEMORYstatic java.lang.StringBUFFERMINPACKETSstatic java.lang.StringCACHEMETAstatic java.lang.StringCHARSETstatic java.lang.StringDATABASENAMEstatic java.lang.StringDOMAINprivate static java.lang.StringdriverPrefixURL prefix used by the driver (i.ejdbc:jtds:).static java.lang.StringINSTANCEstatic java.lang.StringLANGUAGEstatic java.lang.StringLASTUPDATECOUNTstatic java.lang.StringLOBBUFFERstatic java.lang.StringLOGFILEstatic java.lang.StringLOGINTIMEOUTstatic java.lang.StringMACADDRESS(package private) static intMAJOR_VERSIONDriver major version.static java.lang.StringMAXSTATEMENTS(package private) static intMINOR_VERSIONDriver minor version.(package private) static java.lang.StringMISC_VERSIONDriver version miscellanea (e.g "-rc2", ".1" ornull).static java.lang.StringNAMEDPIPEstatic java.lang.StringPACKETSIZEstatic java.lang.StringPASSWORDstatic java.lang.StringPORTNUMBERstatic java.lang.StringPREPARESQLstatic java.lang.StringPROCESSIDstatic java.lang.StringPROGNAMEstatic java.lang.StringSENDSTRINGPARAMETERSASUNICODEstatic java.lang.StringSERVERNAMEstatic java.lang.StringSERVERTYPEstatic java.lang.StringSOKEEPALIVEstatic java.lang.StringSOTIMEOUTstatic intSQLSERVERMicrosoft SQL Server.static java.lang.StringSSLstatic intSYBASESybase ASE.static java.lang.StringTCPNODELAYstatic java.lang.StringTDSstatic intTDS42TDS 4.2 protocol (SQL Server 6.5 and later and Sybase 9 and later).static intTDS50TDS 5.0 protocol (Sybase 10 and later).static intTDS70TDS 7.0 protocol (SQL Server 7.0 and later).static intTDS80TDS 8.0 protocol (SQL Server 2000 and later)static intTDS81TDS 8.1 protocol (SQL Server 2000 SP1 and later).static intTDS90TDS 9.0 protocol (SQL Server 2005 and later)static java.lang.StringUSECURSORSstatic java.lang.StringUSEJCIFSstatic java.lang.StringUSEKERBEROSstatic java.lang.StringUSELOBSstatic java.lang.StringUSENTLMV2static java.lang.StringUSERstatic java.lang.StringWSIDstatic java.lang.StringXAEMULATION
-
Constructor Summary
Constructors Constructor Description Driver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsURL(java.lang.String url)java.sql.Connectionconnect(java.lang.String url, java.util.Properties info)private static java.util.MapcreateChoicesMap()Creates a map of driver properties whosechoicesfield should be set when callinggetPropertyInfo(String, Properties).private static java.util.MapcreateRequiredTrueMap()Creates a map of driver properties that should be marked as required when callinggetPropertyInfo(String, Properties).intgetMajorVersion()intgetMinorVersion()java.util.logging.LoggergetParentLogger()java.sql.DriverPropertyInfo[]getPropertyInfo(java.lang.String url, java.util.Properties props)static java.lang.StringgetVersion()Returns the driver version.booleanjdbcCompliant()static voidmain(java.lang.String[] args)private static intnextToken(java.lang.String url, int pos, java.lang.StringBuilder token)Extract the next lexical token from the URL.private static java.util.PropertiesparseURL(java.lang.String url, java.util.Properties info)Parse the driver URL and extract the properties.private java.util.PropertiessetupConnectProperties(java.lang.String url, java.util.Properties info)Sets up properties for theconnect(String, java.util.Properties)method.java.lang.StringtoString()Returns the string form of the object.
-
-
-
Field Detail
-
driverPrefix
private static java.lang.String driverPrefix
URL prefix used by the driver (i.ejdbc:jtds:).
-
MAJOR_VERSION
static final int MAJOR_VERSION
Driver major version.- See Also:
- Constant Field Values
-
MINOR_VERSION
static final int MINOR_VERSION
Driver minor version.- See Also:
- Constant Field Values
-
MISC_VERSION
static final java.lang.String MISC_VERSION
Driver version miscellanea (e.g "-rc2", ".1" ornull).- See Also:
- Constant Field Values
-
TDS42
public static final int TDS42
TDS 4.2 protocol (SQL Server 6.5 and later and Sybase 9 and later).- See Also:
- Constant Field Values
-
TDS50
public static final int TDS50
TDS 5.0 protocol (Sybase 10 and later).- See Also:
- Constant Field Values
-
TDS70
public static final int TDS70
TDS 7.0 protocol (SQL Server 7.0 and later).- See Also:
- Constant Field Values
-
TDS80
public static final int TDS80
TDS 8.0 protocol (SQL Server 2000 and later)- See Also:
- Constant Field Values
-
TDS81
public static final int TDS81
TDS 8.1 protocol (SQL Server 2000 SP1 and later).- See Also:
- Constant Field Values
-
TDS90
public static final int TDS90
TDS 9.0 protocol (SQL Server 2005 and later)- See Also:
- Constant Field Values
-
SQLSERVER
public static final int SQLSERVER
Microsoft SQL Server.- See Also:
- Constant Field Values
-
SYBASE
public static final int SYBASE
Sybase ASE.- See Also:
- Constant Field Values
-
APPNAME
public static final java.lang.String APPNAME
- See Also:
- Constant Field Values
-
AUTOCOMMIT
public static final java.lang.String AUTOCOMMIT
- See Also:
- Constant Field Values
-
BATCHSIZE
public static final java.lang.String BATCHSIZE
- See Also:
- Constant Field Values
-
BINDADDRESS
public static final java.lang.String BINDADDRESS
- See Also:
- Constant Field Values
-
BUFFERDIR
public static final java.lang.String BUFFERDIR
- See Also:
- Constant Field Values
-
BUFFERMAXMEMORY
public static final java.lang.String BUFFERMAXMEMORY
- See Also:
- Constant Field Values
-
BUFFERMINPACKETS
public static final java.lang.String BUFFERMINPACKETS
- See Also:
- Constant Field Values
-
CACHEMETA
public static final java.lang.String CACHEMETA
- See Also:
- Constant Field Values
-
CHARSET
public static final java.lang.String CHARSET
- See Also:
- Constant Field Values
-
DATABASENAME
public static final java.lang.String DATABASENAME
- See Also:
- Constant Field Values
-
DOMAIN
public static final java.lang.String DOMAIN
- See Also:
- Constant Field Values
-
INSTANCE
public static final java.lang.String INSTANCE
- See Also:
- Constant Field Values
-
LANGUAGE
public static final java.lang.String LANGUAGE
- See Also:
- Constant Field Values
-
LASTUPDATECOUNT
public static final java.lang.String LASTUPDATECOUNT
- See Also:
- Constant Field Values
-
LOBBUFFER
public static final java.lang.String LOBBUFFER
- See Also:
- Constant Field Values
-
LOGFILE
public static final java.lang.String LOGFILE
- See Also:
- Constant Field Values
-
LOGINTIMEOUT
public static final java.lang.String LOGINTIMEOUT
- See Also:
- Constant Field Values
-
MACADDRESS
public static final java.lang.String MACADDRESS
- See Also:
- Constant Field Values
-
MAXSTATEMENTS
public static final java.lang.String MAXSTATEMENTS
- See Also:
- Constant Field Values
-
NAMEDPIPE
public static final java.lang.String NAMEDPIPE
- See Also:
- Constant Field Values
-
PACKETSIZE
public static final java.lang.String PACKETSIZE
- See Also:
- Constant Field Values
-
PASSWORD
public static final java.lang.String PASSWORD
- See Also:
- Constant Field Values
-
PORTNUMBER
public static final java.lang.String PORTNUMBER
- See Also:
- Constant Field Values
-
PREPARESQL
public static final java.lang.String PREPARESQL
- See Also:
- Constant Field Values
-
PROGNAME
public static final java.lang.String PROGNAME
- See Also:
- Constant Field Values
-
SERVERNAME
public static final java.lang.String SERVERNAME
- See Also:
- Constant Field Values
-
SERVERTYPE
public static final java.lang.String SERVERTYPE
- See Also:
- Constant Field Values
-
SOTIMEOUT
public static final java.lang.String SOTIMEOUT
- See Also:
- Constant Field Values
-
SOKEEPALIVE
public static final java.lang.String SOKEEPALIVE
- See Also:
- Constant Field Values
-
PROCESSID
public static final java.lang.String PROCESSID
- See Also:
- Constant Field Values
-
SSL
public static final java.lang.String SSL
- See Also:
- Constant Field Values
-
TCPNODELAY
public static final java.lang.String TCPNODELAY
- See Also:
- Constant Field Values
-
TDS
public static final java.lang.String TDS
- See Also:
- Constant Field Values
-
USECURSORS
public static final java.lang.String USECURSORS
- See Also:
- Constant Field Values
-
USEJCIFS
public static final java.lang.String USEJCIFS
- See Also:
- Constant Field Values
-
USENTLMV2
public static final java.lang.String USENTLMV2
- See Also:
- Constant Field Values
-
USEKERBEROS
public static final java.lang.String USEKERBEROS
- See Also:
- Constant Field Values
-
USELOBS
public static final java.lang.String USELOBS
- See Also:
- Constant Field Values
-
USER
public static final java.lang.String USER
- See Also:
- Constant Field Values
-
SENDSTRINGPARAMETERSASUNICODE
public static final java.lang.String SENDSTRINGPARAMETERSASUNICODE
- See Also:
- Constant Field Values
-
WSID
public static final java.lang.String WSID
- See Also:
- Constant Field Values
-
XAEMULATION
public static final java.lang.String XAEMULATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersionin interfacejava.sql.Driver
-
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersionin interfacejava.sql.Driver
-
getVersion
public static final java.lang.String getVersion()
Returns the driver version.Per [908906] 0.7: Static Version information, please.
- Returns:
- the driver version
-
toString
public java.lang.String toString()
Returns the string form of the object.Per [887120] DriverVersion.getDriverVersion(); this will return a short version name.
Added back to driver per [1006449] 0.9rc1: Driver version broken
- Overrides:
toStringin classjava.lang.Object- Returns:
- the driver version
-
jdbcCompliant
public boolean jdbcCompliant()
- Specified by:
jdbcCompliantin interfacejava.sql.Driver
-
acceptsURL
public boolean acceptsURL(java.lang.String url) throws java.sql.SQLException- Specified by:
acceptsURLin interfacejava.sql.Driver- Throws:
java.sql.SQLException
-
connect
public java.sql.Connection connect(java.lang.String url, java.util.Properties info) throws java.sql.SQLException- Specified by:
connectin interfacejava.sql.Driver- Throws:
java.sql.SQLException
-
getPropertyInfo
public java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties props) throws java.sql.SQLException- Specified by:
getPropertyInfoin interfacejava.sql.Driver- Throws:
java.sql.SQLException
-
setupConnectProperties
private java.util.Properties setupConnectProperties(java.lang.String url, java.util.Properties info) throws java.sql.SQLExceptionSets up properties for theconnect(String, java.util.Properties)method.- Parameters:
url- the URL of the database to which to connectinfo- a list of arbitrary string tag/value pairs as connection arguments.- Returns:
- the set of properties for the connection
- Throws:
java.sql.SQLException- if an error occurs parsing the URL
-
createChoicesMap
private static java.util.Map createChoicesMap()
Creates a map of driver properties whosechoicesfield should be set when callinggetPropertyInfo(String, Properties). The values in the map are theString[]objects that should be set to thechoicesfield.- Returns:
- The map of
DriverPropertyInfoobjects whosechoicesshould be set.
-
createRequiredTrueMap
private static java.util.Map createRequiredTrueMap()
Creates a map of driver properties that should be marked as required when callinggetPropertyInfo(String, Properties). Note that only the key of the map is used to determine whether therequiredfield should be set totrue. If the key does not exist in the map, then therequiredfield is set tofalse.- Returns:
- The map of
DriverPropertyInfoobjects whererequiredshould be set totrue.
-
parseURL
private static java.util.Properties parseURL(java.lang.String url, java.util.Properties info)Parse the driver URL and extract the properties.- Parameters:
url- the URL to parseinfo- any existing properties already loaded in aPropertiesobject- Returns:
- the URL properties as a
Propertiesobject
-
nextToken
private static int nextToken(java.lang.String url, int pos, java.lang.StringBuilder token)Extract the next lexical token from the URL.- Parameters:
url- The URL being parsedpos- The current position in the URL string.token- The buffer containing the extracted token.- Returns:
- The updated position as an
int.
-
main
public static void main(java.lang.String[] args)
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException- Specified by:
getParentLoggerin interfacejava.sql.Driver- Throws:
java.sql.SQLFeatureNotSupportedException
-
-