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.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:
Driver
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APPNAME
static java.lang.String
BATCHSIZE
static java.lang.String
BINDADDRESS
static java.lang.String
BUFFERDIR
static java.lang.String
BUFFERMAXMEMORY
static java.lang.String
BUFFERMINPACKETS
static java.lang.String
CACHEMETA
static java.lang.String
CHARSET
static java.lang.String
DATABASENAME
static java.lang.String
DOMAIN
private static java.lang.String
driverPrefix
URL prefix used by the driver (i.ejdbc:jtds:
).static java.lang.String
INSTANCE
static boolean
JDBC3
Set if the JDBC specification to implement is 3.0 or greater.static java.lang.String
LANGUAGE
static java.lang.String
LASTUPDATECOUNT
static java.lang.String
LOBBUFFER
static java.lang.String
LOGFILE
static java.lang.String
LOGINTIMEOUT
static java.lang.String
MACADDRESS
(package private) static int
MAJOR_VERSION
Driver major version.static java.lang.String
MAXSTATEMENTS
(package private) static int
MINOR_VERSION
Driver minor version.(package private) static java.lang.String
MISC_VERSION
Driver version miscellanea (e.g "-rc2", ".1" ornull
).static java.lang.String
NAMEDPIPE
static java.lang.String
PACKETSIZE
static java.lang.String
PASSWORD
static java.lang.String
PORTNUMBER
static java.lang.String
PREPARESQL
static java.lang.String
PROCESSID
static java.lang.String
PROGNAME
static java.lang.String
SENDSTRINGPARAMETERSASUNICODE
static java.lang.String
SERVERNAME
static java.lang.String
SERVERTYPE
static java.lang.String
SOKEEPALIVE
static java.lang.String
SOTIMEOUT
static int
SQLSERVER
Microsoft SQL Server.static java.lang.String
SSL
static int
SYBASE
Sybase ASE.static java.lang.String
TCPNODELAY
static java.lang.String
TDS
static int
TDS42
TDS 4.2 protocol (SQL Server 6.5 and later and Sybase 9 and later).static int
TDS50
TDS 5.0 protocol (Sybase 10 and later).static int
TDS70
TDS 7.0 protocol (SQL Server 7.0 and later).static int
TDS80
TDS 8.0 protocol (SQL Server 2000 and later)static int
TDS81
TDS 8.1 protocol (SQL Server 2000 SP1 and later).static java.lang.String
USECURSORS
static java.lang.String
USEJCIFS
static java.lang.String
USELOBS
static java.lang.String
USENTLMV2
static java.lang.String
USER
static java.lang.String
WSID
static java.lang.String
XAEMULATION
-
Constructor Summary
Constructors Constructor Description Driver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsURL(java.lang.String url)
java.sql.Connection
connect(java.lang.String url, java.util.Properties info)
private static java.util.Map
createChoicesMap()
Creates a map of driver properties whosechoices
field should be set when callinggetPropertyInfo(String, Properties)
.private static java.util.Map
createRequiredTrueMap()
Creates a map of driver properties that should be marked as required when callinggetPropertyInfo(String, Properties)
.int
getMajorVersion()
int
getMinorVersion()
java.util.logging.Logger
getParentLogger()
java.sql.DriverPropertyInfo[]
getPropertyInfo(java.lang.String url, java.util.Properties props)
static java.lang.String
getVersion()
Returns the driver version.boolean
jdbcCompliant()
static void
main(java.lang.String[] args)
private static int
nextToken(java.lang.String url, int pos, java.lang.StringBuffer token)
Extract the next lexical token from the URL.private static java.util.Properties
parseURL(java.lang.String url, java.util.Properties info)
Parse the driver URL and extract the properties.private java.util.Properties
setupConnectProperties(java.lang.String url, java.util.Properties info)
Sets up properties for theconnect(String, java.util.Properties)
method.java.lang.String
toString()
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
-
JDBC3
public static final boolean JDBC3
Set if the JDBC specification to implement is 3.0 or greater.
-
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
-
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
-
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
-
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:
getMajorVersion
in interfacejava.sql.Driver
-
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersion
in 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:
toString
in classjava.lang.Object
- Returns:
- the driver version
-
jdbcCompliant
public boolean jdbcCompliant()
- Specified by:
jdbcCompliant
in interfacejava.sql.Driver
-
acceptsURL
public boolean acceptsURL(java.lang.String url) throws java.sql.SQLException
- Specified by:
acceptsURL
in 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:
connect
in 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:
getPropertyInfo
in interfacejava.sql.Driver
- Throws:
java.sql.SQLException
-
setupConnectProperties
private java.util.Properties setupConnectProperties(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
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:
java.sql.SQLException
- if an error occurs parsing the URL
-
createChoicesMap
private static java.util.Map 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
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 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
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 aProperties
object- Returns:
- the URL properties as a
Properties
object
-
nextToken
private static int nextToken(java.lang.String url, int pos, java.lang.StringBuffer 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:
getParentLogger
in interfacejava.sql.Driver
- Throws:
java.sql.SQLFeatureNotSupportedException
-
-