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 DefaultProperties

    java.lang.Object
      |
      +--net.sourceforge.jtds.jdbc.DefaultProperties

public final class DefaultProperties
extends java.lang.Object

Container for default property constants.

This class also provides static utility methods for `Properties` and `Settings` objects.

To add new properties to the jTDS driver, do the following:

1. Add `prop.foo` and `prop.desc.foo` properties to `Messages.properties`.
2. Add a `static final` default field to `DefaultProperties`.
3. Update `addDefaultProperties(java.util.Properties)` to set the default.
4. Update `Driver.createChoicesMap()` and `DriverUnitTest.test_getPropertyInfo_Choices()` if the property has a specific set of inputs, e.g., "true" and "false", or "1" and "2".
5. Update `Driver.createRequiredTrueMap()` and `DriverUnitTest.test_getPropertyInfo_Required()` if the property is required.
6. Add a new test to `DefaultPropertiesTestLibrary` for the new property.

Version:
  $Id: DefaultProperties.java,v 1.32 2007/08/22 18:22:04 bheineman Exp $
Author:
  David D. Kilzer

Field Summary
`static java.lang.String` | `APP_NAME` Default `appName` property.
`static java.lang.String` | `BATCH_SIZE_SQLSERVER` Default `batchSize` property for SQL Server.
`static java.lang.String` | `BATCH_SIZE_SYBASE` Default `batchSize` property for Sybase.
`private static java.util.HashMap` | `batchSizeDefaults` Default max batch size based on server type
`static java.lang.String` | `BIND_ADDRESS` Default `bindAddress` property.
`static java.lang.String` | `BUFFER_DIR` Default `tmpDir` property.
`static java.lang.String` | `BUFFER_MAX_MEMORY` Default `bufferMaxMemory` property.
`static java.lang.String` | `BUFFER_MIN_PACKETS` Default `bufferMinPackets` property.
`static java.lang.String` | `CACHEMETA` Default `cacheMetaData` property.
`static java.lang.String` | `CHARSET` Default `charset` property.
`static java.lang.String` | `DATABASE_NAME` Default `databaseName` property.
`static java.lang.String` | `DOMAIN` Default `domain` property.
`static java.lang.String` | `INSTANCE` Default `instance` property.
`static java.lang.String` | `LANGUAGE` Default `language` property.
`static java.lang.String` | `LAST_UPDATE_COUNT` Default `lastUpdateCount` property.
`static java.lang.String` | `LOB_BUFFER_SIZE` Default `lobBufferSize` property.
`static java.lang.String` | `LOGFILE` Default `logfile` property.
`static java.lang.String` | `LOGIN_TIMEOUT` Default `loginTimeout` property.
`static java.lang.String` | `MAC_ADDRESS` Default `macAddress` property.
`static java.lang.String` | `MAX_STATEMENTS` Default `maxStatements` property.
`static java.lang.String` | `NAMED_PIPE` Default `namedPipe` property.
`static java.lang.String` | `NAMED_PIPE_PATH_SQLSERVER` Default `namedPipePath` property for SQL Server.
`static java.lang.String` | `NAMED_PIPE_PATH_SYBASE` Default `namedPipePath` property for Sybase.
`static java.lang.String` | `PACKET_SIZE_42` Default `packetSize` property for TDS 4.2.
`static java.lang.String` | `PACKET_SIZE_50` Default `packetSize` property for TDS 5.0.
`static java.lang.String` | `PACKET_SIZE_70_80` Default `packetSize` property for TDS 7.0 and TDS 8.0.
`private static java.util.HashMap` | `packetSizeDefaults` Default packet size based on TDS version
`static java.lang.String` | `PASSWORD` Default `password` property.
`static java.lang.String` | `PORT_NUMBER_SQLSERVER` Default `portNumber` property for SQL Server.
`static java.lang.String` | `PORT_NUMBER_SYBASE` Default `portNumber` property for Sybase.
`private static java.util.HashMap` | `portNumberDefaults` Default port number based on server type
`static java.lang.String` | `PREPARE_SQLSERVER` Default `prepareSql` property for SQL Server.
`static java.lang.String` | `PREPARE_SYBASE` Default `prepareSql` property for Sybase.
`private static java.util.HashMap` | `prepareSQLDefaults` Default prepare SQL mode based on server type
`static java.lang.String` | `PROG_NAME` Default `progName` property.
`static java.lang.String` | `SERVER_TYPE_SQLSERVER` Default `serverType` property for SQL Server.
`static java.lang.String` | `SERVER_TYPE_SYBASE` Default `serverType` property for Sybase.
`static java.lang.String` | `SOCKET_TIMEOUT` Default `sockeTimeout` property.
`static java.lang.String` | `SSL` Default `ssl` property.
`static java.lang.String` | `TCP_NODELAY` Default `tcpNoDelay` property.
`static java.lang.String` | `TDS_VERSION_42` Default `tds` property for TDS 4.2.
`static java.lang.String` | `TDS_VERSION_50` Default `tds` property for TDS 5.0.
`static java.lang.String` | `TDS_VERSION_70` Default `tds` property for TDS 7.0.
`static java.lang.String` | `TDS_VERSION_80` Default `tds` property for TDS 8.0.
`private static java.util.HashMap` | `tdsDefaults` Default TDS version based on server type
`static java.lang.String` | `USE_UNICODE` Default `sendStringParametersAsUnicode` property.
`static java.lang.String` | `USECURSORS` Default `useCursors` property.
`static java.lang.String` | `USEJCIFS` Default `useJCIFS` property.
`static java.lang.String` | `USELOBS` Default `useLOBs` property.
`static java.lang.String` | `USER` Default `user` property.
`static java.lang.String` | `WSID` Default `wsid` property.
`static java.lang.String` | `XAEMULATION` Default `XaEmulation` property.

Constructor Summary
`DefaultProperties()`

Method Summary
`(package private) static void` | `()`
`static java.util.Properties` | `addDefaultProperties(java.util.Properties props)` Add default properties to the `props` properties object.
`private static void` | `addDefaultPropertyIfNotSet(java.util.Properties props, java.lang.String key, java.lang.String defaultValue)` Sets a default property if the property is not already set.
`private static void` | `addDefaultPropertyIfNotSet(java.util.Properties props, java.lang.String key, java.lang.String defaultKey, java.util.Map defaults)` Sets a default property if the property is not already set, using the `defaultKey` and the `defaults` map to determine the correct value.
`static java.lang.String` | `getNamedPipePath(int serverType)` Returns the default path for the named pipe for a given serverType.
`static java.lang.String` | `getServerType(int serverType)` Converts an integer server type to its string representation.
`static java.lang.Integer` | `getServerType(java.lang.String serverType)` Converts a string server type to its integer representation.
`static java.lang.String` | `getServerTypeWithDefault(int serverType)` Same as `getServerType(int)`, only it returns the default server type (`"sqlserver"`) if `serverType` is 0.
`static java.lang.Integer` | `getTdsVersion(java.lang.String tdsVersion)` Converts a string TDS version to its integer representation.

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

Field Detail

### APP_NAME

    public static final java.lang.String APP_NAME

  Default `appName` property.

### BATCH_SIZE_SQLSERVER

    public static final java.lang.String BATCH_SIZE_SQLSERVER

  Default `batchSize` property for SQL Server.

### BATCH_SIZE_SYBASE

    public static final java.lang.String BATCH_SIZE_SYBASE

  Default `batchSize` property for Sybase.

### BIND_ADDRESS

    public static final java.lang.String BIND_ADDRESS

  Default `bindAddress` property.

### BUFFER_MAX_MEMORY

    public static final java.lang.String BUFFER_MAX_MEMORY

  Default `bufferMaxMemory` property.

### BUFFER_MIN_PACKETS

    public static final java.lang.String BUFFER_MIN_PACKETS

  Default `bufferMinPackets` property.

### CACHEMETA

    public static final java.lang.String CACHEMETA

  Default `cacheMetaData` property.

### CHARSET

    public static final java.lang.String CHARSET

  Default `charset` property.

### DATABASE_NAME

    public static final java.lang.String DATABASE_NAME

  Default `databaseName` property.

### INSTANCE

    public static final java.lang.String INSTANCE

  Default `instance` property.

### DOMAIN

    public static final java.lang.String DOMAIN

  Default `domain` property.

### LAST_UPDATE_COUNT

    public static final java.lang.String LAST_UPDATE_COUNT

  Default `lastUpdateCount` property.

### LOB_BUFFER_SIZE

    public static final java.lang.String LOB_BUFFER_SIZE

  Default `lobBufferSize` property.

### LOGIN_TIMEOUT

    public static final java.lang.String LOGIN_TIMEOUT

  Default `loginTimeout` property.

### MAC_ADDRESS

    public static final java.lang.String MAC_ADDRESS

  Default `macAddress` property.

### MAX_STATEMENTS

    public static final java.lang.String MAX_STATEMENTS

  Default `maxStatements` property.

### NAMED_PIPE

    public static final java.lang.String NAMED_PIPE

  Default `namedPipe` property.

### NAMED_PIPE_PATH_SQLSERVER

    public static final java.lang.String NAMED_PIPE_PATH_SQLSERVER

  Default `namedPipePath` property for SQL Server.

### NAMED_PIPE_PATH_SYBASE

    public static final java.lang.String NAMED_PIPE_PATH_SYBASE

  Default `namedPipePath` property for Sybase.

### PACKET_SIZE_42

    public static final java.lang.String PACKET_SIZE_42

  Default `packetSize` property for TDS 4.2.

### PACKET_SIZE_50

    public static final java.lang.String PACKET_SIZE_50

  Default `packetSize` property for TDS 5.0.

### PACKET_SIZE_70_80

    public static final java.lang.String PACKET_SIZE_70_80

  Default `packetSize` property for TDS 7.0 and TDS 8.0.

### PASSWORD

    public static final java.lang.String PASSWORD

  Default `password` property.

### PORT_NUMBER_SQLSERVER

    public static final java.lang.String PORT_NUMBER_SQLSERVER

  Default `portNumber` property for SQL Server.

### PORT_NUMBER_SYBASE

    public static final java.lang.String PORT_NUMBER_SYBASE

  Default `portNumber` property for Sybase.

### LANGUAGE

    public static final java.lang.String LANGUAGE

  Default `language` property.

### PREPARE_SQLSERVER

    public static final java.lang.String PREPARE_SQLSERVER

  Default `prepareSql` property for SQL Server.

### PREPARE_SYBASE

    public static final java.lang.String PREPARE_SYBASE

  Default `prepareSql` property for Sybase.

### PROG_NAME

    public static final java.lang.String PROG_NAME

  Default `progName` property.

### TCP_NODELAY

    public static final java.lang.String TCP_NODELAY

  Default `tcpNoDelay` property.

### BUFFER_DIR

    public static final java.lang.String BUFFER_DIR

  Default `tmpDir` property.

### USE_UNICODE

    public static final java.lang.String USE_UNICODE

  Default `sendStringParametersAsUnicode` property.

### USECURSORS

    public static final java.lang.String USECURSORS

  Default `useCursors` property.

### USEJCIFS

    public static final java.lang.String USEJCIFS

  Default `useJCIFS` property.

### USELOBS

    public static final java.lang.String USELOBS

  Default `useLOBs` property.

### USER

    public static final java.lang.String USER

  Default `user` property.

### WSID

    public static final java.lang.String WSID

  Default `wsid` property.

### XAEMULATION

    public static final java.lang.String XAEMULATION

  Default `XaEmulation` property.

### LOGFILE

    public static final java.lang.String LOGFILE

  Default `logfile` property.

### SOCKET_TIMEOUT

    public static final java.lang.String SOCKET_TIMEOUT

  Default `sockeTimeout` property.

### SERVER_TYPE_SQLSERVER

    public static final java.lang.String SERVER_TYPE_SQLSERVER

  Default `serverType` property for SQL Server.

### SERVER_TYPE_SYBASE

    public static final java.lang.String SERVER_TYPE_SYBASE

  Default `serverType` property for Sybase.

### TDS_VERSION_42

    public static final java.lang.String TDS_VERSION_42

  Default `tds` property for TDS 4.2.

### TDS_VERSION_50

    public static final java.lang.String TDS_VERSION_50

  Default `tds` property for TDS 5.0.

### TDS_VERSION_70

    public static final java.lang.String TDS_VERSION_70

  Default `tds` property for TDS 7.0.

### TDS_VERSION_80

    public static final java.lang.String TDS_VERSION_80

  Default `tds` property for TDS 8.0.

### SSL

    public static final java.lang.String SSL

  Default `ssl` property.

### tdsDefaults

    private static final java.util.HashMap tdsDefaults

  Default TDS version based on server type

### portNumberDefaults

    private static final java.util.HashMap portNumberDefaults

  Default port number based on server type

### packetSizeDefaults

    private static final java.util.HashMap packetSizeDefaults

  Default packet size based on TDS version

### batchSizeDefaults

    private static final java.util.HashMap batchSizeDefaults

  Default max batch size based on server type

### prepareSQLDefaults

    private static final java.util.HashMap prepareSQLDefaults

  Default prepare SQL mode based on server type

Constructor Detail

### DefaultProperties

    public DefaultProperties()

Method Detail

###

    static void ()

### addDefaultProperties

    public static java.util.Properties addDefaultProperties(java.util.Properties props)

  Add default properties to the `props` properties object.
  Parameters:
    `props` - The properties object.
  Returns:
    The updated `props` object, or `null` if the `serverType` property is not set.

### addDefaultPropertyIfNotSet

    private static void addDefaultPropertyIfNotSet(java.util.Properties props,
                                                   java.lang.String key,
                                                   java.lang.String defaultValue)

  Sets a default property if the property is not already set.
  Parameters:
    `props` - The properties object.
    `key` - The message key to set.
    `defaultValue` - The default value to set.

### addDefaultPropertyIfNotSet

    private static void addDefaultPropertyIfNotSet(java.util.Properties props,
                                                   java.lang.String key,
                                                   java.lang.String defaultKey,
                                                   java.util.Map defaults)

  Sets a default property if the property is not already set, using the `defaultKey` and the `defaults` map to determine the correct value.
  Parameters:
    `props` - The properties object.
    `key` - The message key to set.
    `defaultKey` - The key whose value determines which default value to set from `defaults`.
    `defaults` - The mapping of `defaultKey` values to the correct `key` value to set.

### getNamedPipePath

    public static java.lang.String getNamedPipePath(int serverType)

  Returns the default path for the named pipe for a given serverType.
  Parameters:
    `serverType` - `Driver.SQLSERVER` or `Driver.SYBASE` or `0` (default)
  Returns:
    default named pipe path
  Throws:
    `java.lang.IllegalArgumentException` - if an invalid serverType is given

### getServerType

    public static java.lang.String getServerType(int serverType)

  Converts an integer server type to its string representation.
  Parameters:
    `serverType` - the server type as an `int`
  Returns:
    the server type as a string if known, or `null` if unknown

### getServerType

    public static java.lang.Integer getServerType(java.lang.String serverType)

  Converts a string server type to its integer representation.
  Parameters:
    `serverType` - the server type as a string
  Returns:
    the server type as an integer if known or `null` if unknown

### getServerTypeWithDefault

    public static java.lang.String getServerTypeWithDefault(int serverType)

  Same as `getServerType(int)`, only it returns the default server type (`"sqlserver"`) if `serverType` is 0.
  Parameters:
    `serverType` - integer server type or 0 for default
  Returns:
    the server type as a string if known or `"sqlserver"` if unknown

### getTdsVersion

    public static java.lang.Integer getTdsVersion(java.lang.String tdsVersion)

  Converts a string TDS version to its integer representation.
  Parameters:
    `tdsVersion` - The TDS version as a string.
  Returns:
    The TDS version as an integer if known, or `null` if unknown.

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 August 22 2007