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 String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
private static String
URL prefix used by the driver (i.ejdbc:jtds:
).static final String
static final String
static final String
static final String
static final String
static final String
static final String
(package private) static final int
Driver major version.static final String
(package private) static final int
Driver minor version.(package private) static final String
Driver version miscellanea (e.g "-rc2", ".1" ornull
).static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
Microsoft SQL Server.static final String
static final int
Sybase ASE.static final String
static final String
static final int
TDS 4.2 protocol (SQL Server 6.5 and later and Sybase 9 and later).static final int
TDS 5.0 protocol (Sybase 10 and later).static final int
TDS 7.0 protocol (SQL Server 7.0 and later).static final int
TDS 8.0 protocol (SQL Server 2000 and later)static final int
TDS 8.1 protocol (SQL Server 2000 SP1 and later).static final int
TDS 9.0 protocol (SQL Server 2005 and later)static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptsURL
(String url) connect
(String url, Properties info) private static Map
Creates a map of driver properties whosechoices
field should be set when callinggetPropertyInfo(String, Properties)
.private static Map
Creates a map of driver properties that should be marked as required when callinggetPropertyInfo(String, Properties)
.int
int
getPropertyInfo
(String url, Properties props) static final String
Returns the driver version.boolean
static void
private static int
nextToken
(String url, int pos, StringBuilder token) Extract the next lexical token from the URL.private static Properties
parseURL
(String url, Properties info) Parse the driver URL and extract the properties.private Properties
setupConnectProperties
(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:
getMajorVersion
in interfaceDriver
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersion
in 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:
jdbcCompliant
in interfaceDriver
-
acceptsURL
- Specified by:
acceptsURL
in interfaceDriver
- Throws:
SQLException
-
connect
- Specified by:
connect
in interfaceDriver
- Throws:
SQLException
-
getPropertyInfo
- Specified by:
getPropertyInfo
in 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 whosechoices
field should be set when callinggetPropertyInfo(String, Properties)
. The values in the map are theString[]
objects that should be set to thechoices
field.- Returns:
- The map of
DriverPropertyInfo
objects whosechoices
should 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 therequired
field should be set totrue
. If the key does not exist in the map, then therequired
field is set tofalse
.- Returns:
- The map of
DriverPropertyInfo
objects whererequired
should be set totrue
.
-
parseURL
Parse the driver URL and extract the properties.- Parameters:
url
- the URL to parseinfo
- any existing properties already loaded in aProperties
object- Returns:
- the URL properties as a
Properties
object
-
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:
getParentLogger
in interfaceDriver
- Throws:
SQLFeatureNotSupportedException
-