Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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.65 2005/11/08 12:04:28 alin_sinpalean 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` | `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` | `PROGNAME`
`static java.lang.String` | `SENDSTRINGPARAMETERSASUNICODE`
`static java.lang.String` | `SERVERNAME`
`static java.lang.String` | `SERVERTYPE`
`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` | `USELOBS`
`static java.lang.String` | `USER`
`static java.lang.String` | `WSID`
`static java.lang.String` | `XAEMULATION`

Constructor Summary
`Driver()`

Method Summary
`(package private) static void` | `()`
`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, registerNatives, 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.

### MINOR_VERSION

    static final int MINOR_VERSION

  Driver minor version.

### MISC_VERSION

    static final java.lang.String MISC_VERSION

  Driver version miscellanea (e.g "-rc2", ".1" or `null`).

### 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).

### TDS50

    public static final int TDS50

  TDS 5.0 protocol (Sybase 10 and later).

### TDS70

    public static final int TDS70

  TDS 7.0 protocol (SQL Server 7.0 and later).

### TDS80

    public static final int TDS80

  TDS 8.0 protocol (SQL Server 2000 and later)

### TDS81

    public static final int TDS81

  TDS 8.1 protocol (SQL Server 2000 SP1 and later).

### SQLSERVER

    public static final int SQLSERVER

  Microsoft SQL Server.

### SYBASE

    public static final int SYBASE

  Sybase ASE.

### APPNAME

    public static final java.lang.String APPNAME

### BATCHSIZE

    public static final java.lang.String BATCHSIZE

### BUFFERMAXMEMORY

    public static final java.lang.String BUFFERMAXMEMORY

### BUFFERMINPACKETS

    public static final java.lang.String BUFFERMINPACKETS

### CACHEMETA

    public static final java.lang.String CACHEMETA

### CHARSET

    public static final java.lang.String CHARSET

### DATABASENAME

    public static final java.lang.String DATABASENAME

### DOMAIN

    public static final java.lang.String DOMAIN

### INSTANCE

    public static final java.lang.String INSTANCE

### LANGUAGE

    public static final java.lang.String LANGUAGE

### LASTUPDATECOUNT

    public static final java.lang.String LASTUPDATECOUNT

### LOBBUFFER

    public static final java.lang.String LOBBUFFER

### LOGFILE

    public static final java.lang.String LOGFILE

### LOGINTIMEOUT

    public static final java.lang.String LOGINTIMEOUT

### MACADDRESS

    public static final java.lang.String MACADDRESS

### MAXSTATEMENTS

    public static final java.lang.String MAXSTATEMENTS

### NAMEDPIPE

    public static final java.lang.String NAMEDPIPE

### PACKETSIZE

    public static final java.lang.String PACKETSIZE

### PASSWORD

    public static final java.lang.String PASSWORD

### PORTNUMBER

    public static final java.lang.String PORTNUMBER

### PREPARESQL

    public static final java.lang.String PREPARESQL

### PROGNAME

    public static final java.lang.String PROGNAME

### SERVERNAME

    public static final java.lang.String SERVERNAME

### SERVERTYPE

    public static final java.lang.String SERVERTYPE

### SOTIMEOUT

    public static final java.lang.String SOTIMEOUT

### SSL

    public static final java.lang.String SSL

### TCPNODELAY

    public static final java.lang.String TCPNODELAY

### TDS

    public static final java.lang.String TDS

### USECURSORS

    public static final java.lang.String USECURSORS

### USELOBS

    public static final java.lang.String USELOBS

### USER

    public static final java.lang.String USER

### SENDSTRINGPARAMETERSASUNICODE

    public static final java.lang.String SENDSTRINGPARAMETERSASUNICODE

### WSID

    public static final java.lang.String WSID

### XAEMULATION

    public static final java.lang.String XAEMULATION

Constructor Detail

### Driver

    public Driver()

Method Detail

###

    static void ()

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

  Overrides:
    `toString` in class `java.lang.Object`
  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`

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

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

### 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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Generated on November 8 2005