Package net.sourceforge.jtds.jdbc
Class Driver
java.lang.Object
net.sourceforge.jtds.jdbc.Driver
- All Implemented Interfaces:
Driver
jTDS 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate static StringURL prefix used by the driver (i.ejdbc:jtds:).static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String(package private) static final intDriver major version.static final String(package private) static final intDriver minor version.(package private) static final StringDriver version miscellanea (e.g "-rc2", ".1" ornull).static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intMicrosoft SQL Server.static final Stringstatic final intSybase ASE.static final Stringstatic final Stringstatic final intTDS 4.2 protocol (SQL Server 6.5 and later and Sybase 9 and later).static final intTDS 5.0 protocol (Sybase 10 and later).static final intTDS 7.0 protocol (SQL Server 7.0 and later).static final intTDS 8.0 protocol (SQL Server 2000 and later)static final intTDS 8.1 protocol (SQL Server 2000 SP1 and later).static final intTDS 9.0 protocol (SQL Server 2005 and later)static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsURL(String url) connect(String url, Properties info) private static MapCreates a map of driver properties whosechoicesfield should be set when callinggetPropertyInfo(String, Properties).private static MapCreates a map of driver properties that should be marked as required when callinggetPropertyInfo(String, Properties).intintgetPropertyInfo(String url, Properties props) static final StringReturns the driver version.booleanstatic voidprivate static intnextToken(String url, int pos, StringBuilder token) Extract the next lexical token from the URL.private static PropertiesparseURL(String url, Properties info) Parse the driver URL and extract the properties.private PropertiessetupConnectProperties(String url, Properties info) Sets up properties for theconnect(String, java.util.Properties)method.toString()Returns the string form of the object.
-
Field Details
-
driverPrefix
URL prefix used by the driver (i.ejdbc:jtds:). -
MAJOR_VERSION
static final int MAJOR_VERSIONDriver major version.- See Also:
-
MINOR_VERSION
static final int MINOR_VERSIONDriver minor version.- See Also:
-
MISC_VERSION
Driver version miscellanea (e.g "-rc2", ".1" ornull).- See Also:
-
TDS42
public static final int TDS42TDS 4.2 protocol (SQL Server 6.5 and later and Sybase 9 and later).- See Also:
-
TDS50
public static final int TDS50TDS 5.0 protocol (Sybase 10 and later).- See Also:
-
TDS70
public static final int TDS70TDS 7.0 protocol (SQL Server 7.0 and later).- See Also:
-
TDS80
public static final int TDS80TDS 8.0 protocol (SQL Server 2000 and later)- See Also:
-
TDS81
public static final int TDS81TDS 8.1 protocol (SQL Server 2000 SP1 and later).- See Also:
-
TDS90
public static final int TDS90TDS 9.0 protocol (SQL Server 2005 and later)- See Also:
-
SQLSERVER
public static final int SQLSERVERMicrosoft SQL Server.- See Also:
-
SYBASE
public static final int SYBASESybase ASE.- See Also:
-
APPNAME
- See Also:
-
AUTOCOMMIT
- See Also:
-
BATCHSIZE
- See Also:
-
BINDADDRESS
- See Also:
-
BUFFERDIR
- See Also:
-
BUFFERMAXMEMORY
- See Also:
-
BUFFERMINPACKETS
- See Also:
-
CACHEMETA
- See Also:
-
CHARSET
- See Also:
-
DATABASENAME
- See Also:
-
DOMAIN
- See Also:
-
INSTANCE
- See Also:
-
LANGUAGE
- See Also:
-
LASTUPDATECOUNT
- See Also:
-
LOBBUFFER
- See Also:
-
LOGFILE
- See Also:
-
LOGINTIMEOUT
- See Also:
-
MACADDRESS
- See Also:
-
MAXSTATEMENTS
- See Also:
-
NAMEDPIPE
- See Also:
-
PACKETSIZE
- See Also:
-
PASSWORD
- See Also:
-
PORTNUMBER
- See Also:
-
PREPARESQL
- See Also:
-
PROGNAME
- See Also:
-
SERVERNAME
- See Also:
-
SERVERTYPE
- See Also:
-
SOTIMEOUT
- See Also:
-
SOKEEPALIVE
- See Also:
-
PROCESSID
- See Also:
-
SSL
- See Also:
-
TCPNODELAY
- See Also:
-
TDS
- See Also:
-
USECURSORS
- See Also:
-
USEJCIFS
- See Also:
-
USENTLMV2
- See Also:
-
USEKERBEROS
- See Also:
-
USELOBS
- See Also:
-
USER
- See Also:
-
SENDSTRINGPARAMETERSASUNICODE
- See Also:
-
WSID
- See Also:
-
XAEMULATION
- See Also:
-
-
Constructor Details
-
Driver
public Driver()
-
-
Method Details
-
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersionin interfaceDriver
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersionin interfaceDriver
-
getVersion
Returns the driver version.Per [908906] 0.7: Static Version information, please.
- Returns:
- the driver version
-
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
-
jdbcCompliant
public boolean jdbcCompliant()- Specified by:
jdbcCompliantin interfaceDriver
-
acceptsURL
- Specified by:
acceptsURLin interfaceDriver- Throws:
SQLException
-
connect
- Specified by:
connectin interfaceDriver- Throws:
SQLException
-
getPropertyInfo
- Specified by:
getPropertyInfoin interfaceDriver- Throws:
SQLException
-
setupConnectProperties
Sets 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:
SQLException- if an error occurs parsing the URL
-
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
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
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
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
-
getParentLogger
- Specified by:
getParentLoggerin interfaceDriver- Throws:
SQLFeatureNotSupportedException
-