net.sourceforge.jtds.jdbc
Class DefaultProperties

java.lang.Object
  extended bynet.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.2.1 2009-08-07 14:02:09 ickzon Exp $
Author:
David D. Kilzer

Field Summary
static java.lang.String APP_NAME
          Default appName property.
static java.lang.String AUTO_COMMIT
          Default autoCommit 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 PROCESS_ID
          Default processId property.
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_KEEPALIVE
          Default socketKeepAlive property.
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 USENTLMV2
          Default useNTLMv2 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
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, toString, wait, wait, wait
 

Field Detail

APP_NAME

public static final java.lang.String APP_NAME
Default appName property.

See Also:
Constant Field Values

AUTO_COMMIT

public static final java.lang.String AUTO_COMMIT
Default autoCommit property.

See Also:
Constant Field Values

BATCH_SIZE_SQLSERVER

public static final java.lang.String BATCH_SIZE_SQLSERVER
Default batchSize property for SQL Server.

See Also:
Constant Field Values

BATCH_SIZE_SYBASE

public static final java.lang.String BATCH_SIZE_SYBASE
Default batchSize property for Sybase.

See Also:
Constant Field Values

BIND_ADDRESS

public static final java.lang.String BIND_ADDRESS
Default bindAddress property.

See Also:
Constant Field Values

BUFFER_MAX_MEMORY

public static final java.lang.String BUFFER_MAX_MEMORY
Default bufferMaxMemory property.

See Also:
Constant Field Values

BUFFER_MIN_PACKETS

public static final java.lang.String BUFFER_MIN_PACKETS
Default bufferMinPackets property.

See Also:
Constant Field Values

CACHEMETA

public static final java.lang.String CACHEMETA
Default cacheMetaData property.

See Also:
Constant Field Values

CHARSET

public static final java.lang.String CHARSET
Default charset property.

See Also:
Constant Field Values

DATABASE_NAME

public static final java.lang.String DATABASE_NAME
Default databaseName property.

See Also:
Constant Field Values

INSTANCE

public static final java.lang.String INSTANCE
Default instance property.

See Also:
Constant Field Values

DOMAIN

public static final java.lang.String DOMAIN
Default domain property.

See Also:
Constant Field Values

LAST_UPDATE_COUNT

public static final java.lang.String LAST_UPDATE_COUNT
Default lastUpdateCount property.

See Also:
Constant Field Values

LOB_BUFFER_SIZE

public static final java.lang.String LOB_BUFFER_SIZE
Default lobBufferSize property.

See Also:
Constant Field Values

LOGIN_TIMEOUT

public static final java.lang.String LOGIN_TIMEOUT
Default loginTimeout property.

See Also:
Constant Field Values

MAC_ADDRESS

public static final java.lang.String MAC_ADDRESS
Default macAddress property.

See Also:
Constant Field Values

MAX_STATEMENTS

public static final java.lang.String MAX_STATEMENTS
Default maxStatements property.

See Also:
Constant Field Values

NAMED_PIPE

public static final java.lang.String NAMED_PIPE
Default namedPipe property.

See Also:
Constant Field Values

NAMED_PIPE_PATH_SQLSERVER

public static final java.lang.String NAMED_PIPE_PATH_SQLSERVER
Default namedPipePath property for SQL Server.

See Also:
Constant Field Values

NAMED_PIPE_PATH_SYBASE

public static final java.lang.String NAMED_PIPE_PATH_SYBASE
Default namedPipePath property for Sybase.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

PASSWORD

public static final java.lang.String PASSWORD
Default password property.

See Also:
Constant Field Values

PORT_NUMBER_SQLSERVER

public static final java.lang.String PORT_NUMBER_SQLSERVER
Default portNumber property for SQL Server.

See Also:
Constant Field Values

PORT_NUMBER_SYBASE

public static final java.lang.String PORT_NUMBER_SYBASE
Default portNumber property for Sybase.

See Also:
Constant Field Values

LANGUAGE

public static final java.lang.String LANGUAGE
Default language property.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

TCP_NODELAY

public static final java.lang.String TCP_NODELAY
Default tcpNoDelay property.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

USECURSORS

public static final java.lang.String USECURSORS
Default useCursors property.

See Also:
Constant Field Values

USEJCIFS

public static final java.lang.String USEJCIFS
Default useJCIFS property.

See Also:
Constant Field Values

USELOBS

public static final java.lang.String USELOBS
Default useLOBs property.

See Also:
Constant Field Values

USENTLMV2

public static final java.lang.String USENTLMV2
Default useNTLMv2 property.

See Also:
Constant Field Values

USER

public static final java.lang.String USER
Default user property.

See Also:
Constant Field Values

WSID

public static final java.lang.String WSID
Default wsid property.

See Also:
Constant Field Values

XAEMULATION

public static final java.lang.String XAEMULATION
Default XaEmulation property.

See Also:
Constant Field Values

LOGFILE

public static final java.lang.String LOGFILE
Default logfile property.

See Also:
Constant Field Values

SOCKET_TIMEOUT

public static final java.lang.String SOCKET_TIMEOUT
Default sockeTimeout property.

See Also:
Constant Field Values

SOCKET_KEEPALIVE

public static final java.lang.String SOCKET_KEEPALIVE
Default socketKeepAlive property.

See Also:
Constant Field Values

PROCESS_ID

public static final java.lang.String PROCESS_ID
Default processId property.

See Also:
Constant Field Values

SERVER_TYPE_SQLSERVER

public static final java.lang.String SERVER_TYPE_SQLSERVER
Default serverType property for SQL Server.

See Also:
Constant Field Values

SERVER_TYPE_SYBASE

public static final java.lang.String SERVER_TYPE_SYBASE
Default serverType property for Sybase.

See Also:
Constant Field Values

TDS_VERSION_42

public static final java.lang.String TDS_VERSION_42
Default tds property for TDS 4.2.

See Also:
Constant Field Values

TDS_VERSION_50

public static final java.lang.String TDS_VERSION_50
Default tds property for TDS 5.0.

See Also:
Constant Field Values

TDS_VERSION_70

public static final java.lang.String TDS_VERSION_70
Default tds property for TDS 7.0.

See Also:
Constant Field Values

TDS_VERSION_80

public static final java.lang.String TDS_VERSION_80
Default tds property for TDS 8.0.

See Also:
Constant Field Values

SSL

public static final java.lang.String SSL
Default ssl property.

See Also:
Constant Field Values

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

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.


Generated on October 27 2012