Package 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 forProperties
andSettings
objects. To add new properties to the jTDS driver, do the following:- Add
prop.foo
andprop.desc.foo
properties toMessages.properties
. - Add a
static final
default field toDefaultProperties
. - Update
addDefaultProperties(java.util.Properties)
to set the default. - Update
Driver.createChoicesMap()
andDriverUnitTest.test_getPropertyInfo_Choices()
if the property has a specific set of inputs, e.g., "true" and "false", or "1" and "2". - Update
Driver.createRequiredTrueMap()
andDriverUnitTest.test_getPropertyInfo_Required()
if the property is required. - 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
- Add
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APP_NAME
DefaultappName
property.static java.lang.String
BATCH_SIZE_SQLSERVER
DefaultbatchSize
property for SQL Server.static java.lang.String
BATCH_SIZE_SYBASE
DefaultbatchSize
property for Sybase.private static java.util.HashMap
batchSizeDefaults
Default max batch size based on server typestatic java.lang.String
BIND_ADDRESS
DefaultbindAddress
property.static java.lang.String
BUFFER_DIR
DefaulttmpDir
property.static java.lang.String
BUFFER_MAX_MEMORY
DefaultbufferMaxMemory
property.static java.lang.String
BUFFER_MIN_PACKETS
DefaultbufferMinPackets
property.static java.lang.String
CACHEMETA
DefaultcacheMetaData
property.static java.lang.String
CHARSET
Defaultcharset
property.static java.lang.String
DATABASE_NAME
DefaultdatabaseName
property.static java.lang.String
DOMAIN
Defaultdomain
property.static java.lang.String
INSTANCE
Defaultinstance
property.static java.lang.String
LANGUAGE
Defaultlanguage
property.static java.lang.String
LAST_UPDATE_COUNT
DefaultlastUpdateCount
property.static java.lang.String
LOB_BUFFER_SIZE
DefaultlobBufferSize
property.static java.lang.String
LOGFILE
Defaultlogfile
property.static java.lang.String
LOGIN_TIMEOUT
DefaultloginTimeout
property.static java.lang.String
MAC_ADDRESS
DefaultmacAddress
property.static java.lang.String
MAX_STATEMENTS
DefaultmaxStatements
property.static java.lang.String
NAMED_PIPE
DefaultnamedPipe
property.static java.lang.String
NAMED_PIPE_PATH_SQLSERVER
DefaultnamedPipePath
property for SQL Server.static java.lang.String
NAMED_PIPE_PATH_SYBASE
DefaultnamedPipePath
property for Sybase.static java.lang.String
PACKET_SIZE_42
DefaultpacketSize
property for TDS 4.2.static java.lang.String
PACKET_SIZE_50
DefaultpacketSize
property for TDS 5.0.static java.lang.String
PACKET_SIZE_70_80
DefaultpacketSize
property for TDS 7.0 and TDS 8.0.private static java.util.HashMap
packetSizeDefaults
Default packet size based on TDS versionstatic java.lang.String
PASSWORD
Defaultpassword
property.static java.lang.String
PORT_NUMBER_SQLSERVER
DefaultportNumber
property for SQL Server.static java.lang.String
PORT_NUMBER_SYBASE
DefaultportNumber
property for Sybase.private static java.util.HashMap
portNumberDefaults
Default port number based on server typestatic java.lang.String
PREPARE_SQLSERVER
DefaultprepareSql
property for SQL Server.static java.lang.String
PREPARE_SYBASE
DefaultprepareSql
property for Sybase.private static java.util.HashMap
prepareSQLDefaults
Default prepare SQL mode based on server typestatic java.lang.String
PROCESS_ID
DefaultprocessId
property.static java.lang.String
PROG_NAME
DefaultprogName
property.static java.lang.String
SERVER_TYPE_SQLSERVER
DefaultserverType
property for SQL Server.static java.lang.String
SERVER_TYPE_SYBASE
DefaultserverType
property for Sybase.static java.lang.String
SOCKET_KEEPALIVE
DefaultsocketKeepAlive
property.static java.lang.String
SOCKET_TIMEOUT
DefaultsockeTimeout
property.static java.lang.String
SSL
Defaultssl
property.static java.lang.String
TCP_NODELAY
DefaulttcpNoDelay
property.static java.lang.String
TDS_VERSION_42
Defaulttds
property for TDS 4.2.static java.lang.String
TDS_VERSION_50
Defaulttds
property for TDS 5.0.static java.lang.String
TDS_VERSION_70
Defaulttds
property for TDS 7.0.static java.lang.String
TDS_VERSION_80
Defaulttds
property for TDS 8.0.private static java.util.HashMap
tdsDefaults
Default TDS version based on server typestatic java.lang.String
USE_UNICODE
DefaultsendStringParametersAsUnicode
property.static java.lang.String
USECURSORS
DefaultuseCursors
property.static java.lang.String
USEJCIFS
DefaultuseJCIFS
property.static java.lang.String
USELOBS
DefaultuseLOBs
property.static java.lang.String
USER
Defaultuser
property.static java.lang.String
WSID
Defaultwsid
property.static java.lang.String
XAEMULATION
DefaultXaEmulation
property.
-
Constructor Summary
Constructors Constructor Description DefaultProperties()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Properties
addDefaultProperties(java.util.Properties props)
Add default properties to theprops
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 thedefaultKey
and thedefaults
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 asgetServerType(int)
, only it returns the default server type ("sqlserver"
) ifserverType
is 0.static java.lang.Integer
getTdsVersion(java.lang.String tdsVersion)
Converts a string TDS version to its integer representation.
-
-
-
Field Detail
-
APP_NAME
public static final java.lang.String APP_NAME
DefaultappName
property.- See Also:
- Constant Field Values
-
BATCH_SIZE_SQLSERVER
public static final java.lang.String BATCH_SIZE_SQLSERVER
DefaultbatchSize
property for SQL Server.- See Also:
- Constant Field Values
-
BATCH_SIZE_SYBASE
public static final java.lang.String BATCH_SIZE_SYBASE
DefaultbatchSize
property for Sybase.- See Also:
- Constant Field Values
-
BIND_ADDRESS
public static final java.lang.String BIND_ADDRESS
DefaultbindAddress
property.- See Also:
- Constant Field Values
-
BUFFER_MAX_MEMORY
public static final java.lang.String BUFFER_MAX_MEMORY
DefaultbufferMaxMemory
property.- See Also:
- Constant Field Values
-
BUFFER_MIN_PACKETS
public static final java.lang.String BUFFER_MIN_PACKETS
DefaultbufferMinPackets
property.- See Also:
- Constant Field Values
-
CACHEMETA
public static final java.lang.String CACHEMETA
DefaultcacheMetaData
property.- See Also:
- Constant Field Values
-
CHARSET
public static final java.lang.String CHARSET
Defaultcharset
property.- See Also:
- Constant Field Values
-
DATABASE_NAME
public static final java.lang.String DATABASE_NAME
DefaultdatabaseName
property.- See Also:
- Constant Field Values
-
INSTANCE
public static final java.lang.String INSTANCE
Defaultinstance
property.- See Also:
- Constant Field Values
-
DOMAIN
public static final java.lang.String DOMAIN
Defaultdomain
property.- See Also:
- Constant Field Values
-
LAST_UPDATE_COUNT
public static final java.lang.String LAST_UPDATE_COUNT
DefaultlastUpdateCount
property.- See Also:
- Constant Field Values
-
LOB_BUFFER_SIZE
public static final java.lang.String LOB_BUFFER_SIZE
DefaultlobBufferSize
property.- See Also:
- Constant Field Values
-
LOGIN_TIMEOUT
public static final java.lang.String LOGIN_TIMEOUT
DefaultloginTimeout
property.- See Also:
- Constant Field Values
-
MAC_ADDRESS
public static final java.lang.String MAC_ADDRESS
DefaultmacAddress
property.- See Also:
- Constant Field Values
-
MAX_STATEMENTS
public static final java.lang.String MAX_STATEMENTS
DefaultmaxStatements
property.- See Also:
- Constant Field Values
-
NAMED_PIPE
public static final java.lang.String NAMED_PIPE
DefaultnamedPipe
property.- See Also:
- Constant Field Values
-
NAMED_PIPE_PATH_SQLSERVER
public static final java.lang.String NAMED_PIPE_PATH_SQLSERVER
DefaultnamedPipePath
property for SQL Server.- See Also:
- Constant Field Values
-
NAMED_PIPE_PATH_SYBASE
public static final java.lang.String NAMED_PIPE_PATH_SYBASE
DefaultnamedPipePath
property for Sybase.- See Also:
- Constant Field Values
-
PACKET_SIZE_42
public static final java.lang.String PACKET_SIZE_42
DefaultpacketSize
property for TDS 4.2.
-
PACKET_SIZE_50
public static final java.lang.String PACKET_SIZE_50
DefaultpacketSize
property for TDS 5.0.- See Also:
- Constant Field Values
-
PACKET_SIZE_70_80
public static final java.lang.String PACKET_SIZE_70_80
DefaultpacketSize
property for TDS 7.0 and TDS 8.0.- See Also:
- Constant Field Values
-
PASSWORD
public static final java.lang.String PASSWORD
Defaultpassword
property.- See Also:
- Constant Field Values
-
PORT_NUMBER_SQLSERVER
public static final java.lang.String PORT_NUMBER_SQLSERVER
DefaultportNumber
property for SQL Server.- See Also:
- Constant Field Values
-
PORT_NUMBER_SYBASE
public static final java.lang.String PORT_NUMBER_SYBASE
DefaultportNumber
property for Sybase.- See Also:
- Constant Field Values
-
LANGUAGE
public static final java.lang.String LANGUAGE
Defaultlanguage
property.- See Also:
- Constant Field Values
-
PREPARE_SQLSERVER
public static final java.lang.String PREPARE_SQLSERVER
DefaultprepareSql
property for SQL Server.
-
PREPARE_SYBASE
public static final java.lang.String PREPARE_SYBASE
DefaultprepareSql
property for Sybase.
-
PROG_NAME
public static final java.lang.String PROG_NAME
DefaultprogName
property.- See Also:
- Constant Field Values
-
TCP_NODELAY
public static final java.lang.String TCP_NODELAY
DefaulttcpNoDelay
property.- See Also:
- Constant Field Values
-
BUFFER_DIR
public static final java.lang.String BUFFER_DIR
DefaulttmpDir
property.
-
USE_UNICODE
public static final java.lang.String USE_UNICODE
DefaultsendStringParametersAsUnicode
property.- See Also:
- Constant Field Values
-
USECURSORS
public static final java.lang.String USECURSORS
DefaultuseCursors
property.- See Also:
- Constant Field Values
-
USEJCIFS
public static final java.lang.String USEJCIFS
DefaultuseJCIFS
property.- See Also:
- Constant Field Values
-
USELOBS
public static final java.lang.String USELOBS
DefaultuseLOBs
property.- See Also:
- Constant Field Values
-
USER
public static final java.lang.String USER
Defaultuser
property.- See Also:
- Constant Field Values
-
WSID
public static final java.lang.String WSID
Defaultwsid
property.- See Also:
- Constant Field Values
-
XAEMULATION
public static final java.lang.String XAEMULATION
DefaultXaEmulation
property.- See Also:
- Constant Field Values
-
LOGFILE
public static final java.lang.String LOGFILE
Defaultlogfile
property.- See Also:
- Constant Field Values
-
SOCKET_TIMEOUT
public static final java.lang.String SOCKET_TIMEOUT
DefaultsockeTimeout
property.- See Also:
- Constant Field Values
-
SOCKET_KEEPALIVE
public static final java.lang.String SOCKET_KEEPALIVE
DefaultsocketKeepAlive
property.- See Also:
- Constant Field Values
-
PROCESS_ID
public static final java.lang.String PROCESS_ID
DefaultprocessId
property.- See Also:
- Constant Field Values
-
SERVER_TYPE_SQLSERVER
public static final java.lang.String SERVER_TYPE_SQLSERVER
DefaultserverType
property for SQL Server.- See Also:
- Constant Field Values
-
SERVER_TYPE_SYBASE
public static final java.lang.String SERVER_TYPE_SYBASE
DefaultserverType
property for Sybase.- See Also:
- Constant Field Values
-
TDS_VERSION_42
public static final java.lang.String TDS_VERSION_42
Defaulttds
property for TDS 4.2.- See Also:
- Constant Field Values
-
TDS_VERSION_50
public static final java.lang.String TDS_VERSION_50
Defaulttds
property for TDS 5.0.- See Also:
- Constant Field Values
-
TDS_VERSION_70
public static final java.lang.String TDS_VERSION_70
Defaulttds
property for TDS 7.0.- See Also:
- Constant Field Values
-
TDS_VERSION_80
public static final java.lang.String TDS_VERSION_80
Defaulttds
property for TDS 8.0.- See Also:
- Constant Field Values
-
SSL
public static final java.lang.String SSL
Defaultssl
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
-
-
Method Detail
-
addDefaultProperties
public static java.util.Properties addDefaultProperties(java.util.Properties props)
Add default properties to theprops
properties object.- Parameters:
props
- The properties object.- Returns:
- The updated
props
object, ornull
if theserverType
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 thedefaultKey
and thedefaults
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 fromdefaults
.defaults
- The mapping ofdefaultKey
values to the correctkey
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
orDriver.SYBASE
or0
(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 anint
- 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 asgetServerType(int)
, only it returns the default server type ("sqlserver"
) ifserverType
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.
-
-