Driver (jTDS API)
Keywords: net.sourceforge.jtds.jdbc.Driver class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:

1. 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.
2. 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
`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.e `jdbc: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" or `null`).
`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
`Driver()`

Method Summary
`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 whose `choices` field should be set when calling `getPropertyInfo(String, Properties)`.
`private static java.util.Map` | `createRequiredTrueMap()` Creates a map of driver properties that should be marked as required when calling `getPropertyInfo(String, Properties)`.
`int` | `getMajorVersion()`
`int` | `getMinorVersion()`
`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 the `connect(String, java.util.Properties)` method.
`java.lang.String` | `toString()` Returns the string form of the object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### driverPrefix

    private static java.lang.String driverPrefix

  URL prefix used by the driver (i.e `jdbc: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" or `null`).

  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

Constructor Detail

### Driver

    public Driver()

Method Detail

### getMajorVersion

    public int getMajorVersion()

  Specified by:
    `getMajorVersion` in interface `java.sql.Driver`

### getMinorVersion

    public int getMinorVersion()

  Specified by:
    `getMinorVersion` in interface `java.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

  Returns:
    the driver version

### jdbcCompliant

    public boolean jdbcCompliant()

  Specified by:
    `jdbcCompliant` in interface `java.sql.Driver`

### acceptsURL

    public boolean acceptsURL(java.lang.String url)
                       throws java.sql.SQLException

  Specified by:
    `acceptsURL` in interface `java.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 interface `java.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 interface `java.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 the `connect(String, java.util.Properties)` method.

  Parameters:
    `url` - the URL of the database to which to connect
    `info` - 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 whose `choices` field should be set when calling `getPropertyInfo(String, Properties)`.

  The values in the map are the `String[]` objects that should be set to the `choices` field.

  Returns:
    The map of `DriverPropertyInfo` objects whose `choices` should be set.

### createRequiredTrueMap

    private static java.util.Map createRequiredTrueMap()

  Creates a map of driver properties that should be marked as required when calling `getPropertyInfo(String, Properties)`.

  Note that only the key of the map is used to determine whether the `required` field should be set to `true`. If the key does not exist in the map, then the `required` field is set to `false`.

  Returns:
    The map of `DriverPropertyInfo` objects where `required` should be set to `true`.

### 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 parse
    `info` - any existing properties already loaded in a `Properties` 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 parsed
    `pos` - 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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Generated on December 30 2009