Package net.sourceforge.jtds.jdbc
Class DefaultProperties
java.lang.Object
net.sourceforge.jtds.jdbc.DefaultProperties
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:
- 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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
DefaultappName
property.static final String
DefaultautoCommit
property.static final String
DefaultbatchSize
property for SQL Server.static final String
DefaultbatchSize
property for Sybase.private static final HashMap
Default max batch size based on server typestatic final String
DefaultbindAddress
property.static final String
DefaulttmpDir
property.static final String
DefaultbufferMaxMemory
property.static final String
DefaultbufferMinPackets
property.static final String
DefaultcacheMetaData
property.static final String
Defaultcharset
property.static final String
DefaultdatabaseName
property.static final String
Defaultdomain
property.static final String
Defaultinstance
property.static final String
Defaultlanguage
property.static final String
DefaultlastUpdateCount
property.static final String
DefaultlobBufferSize
property.static final String
Defaultlogfile
property.static final String
DefaultloginTimeout
property.static final String
DefaultmacAddress
property.static final String
DefaultmaxStatements
property.static final String
DefaultnamedPipe
property.static final String
DefaultnamedPipePath
property for SQL Server.static final String
DefaultnamedPipePath
property for Sybase.static final String
DefaultpacketSize
property for TDS 4.2.static final String
DefaultpacketSize
property for TDS 5.0.static final String
DefaultpacketSize
property for TDS 7.0 and TDS 8.0.private static final HashMap
Default packet size based on TDS versionstatic final String
Defaultpassword
property.static final String
DefaultportNumber
property for SQL Server.static final String
DefaultportNumber
property for Sybase.private static final HashMap
Default port number based on server typestatic final String
DefaultprepareSql
property for SQL Server.static final String
DefaultprepareSql
property for Sybase.private static final HashMap
Default prepare SQL mode based on server typestatic final String
DefaultprocessId
property.static final String
DefaultprogName
property.static final String
DefaultserverType
property for SQL Server.static final String
DefaultserverType
property for Sybase.static final String
DefaultsocketKeepAlive
property.static final String
DefaultsockeTimeout
property.static final String
Defaultssl
property.static final String
DefaulttcpNoDelay
property.static final String
Defaulttds
property for TDS 4.2.static final String
Defaulttds
property for TDS 5.0.static final String
Defaulttds
property for TDS 7.0.static final String
Defaulttds
property for TDS 8.0.static final String
Defaulttds
property for TDS 9.0.private static final HashMap
Default TDS version based on server typestatic final String
DefaultsendStringParametersAsUnicode
property.static final String
DefaultuseCursors
property.static final String
DefaultuseJCIFS
property.static final String
DefaultuseKerberos
property.static final String
DefaultuseLOBs
property.static final String
DefaultuseNTLMv2
property.static final String
Defaultuser
property.static final String
Defaultwsid
property.static final String
DefaultXaEmulation
property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Properties
addDefaultProperties
(Properties props) Add default properties to theprops
properties object.private static void
addDefaultPropertyIfNotSet
(Properties props, String key, String defaultValue) Sets a default property if the property is not already set.private static void
addDefaultPropertyIfNotSet
(Properties props, String key, String defaultKey, Map defaults) Sets a default property if the property is not already set, using thedefaultKey
and thedefaults
map to determine the correct value.static String
getNamedPipePath
(int serverType) Returns the default path for the named pipe for a given serverType.static String
getServerType
(int serverType) Converts an integer server type to its string representation.static Integer
getServerType
(String serverType) Converts a string server type to its integer representation.static String
getServerTypeWithDefault
(int serverType) Same asgetServerType(int)
, only it returns the default server type ("sqlserver"
) ifserverType
is 0.static Integer
getTdsVersion
(String tdsVersion) Converts a string TDS version to its integer representation.
-
Field Details
-
APP_NAME
DefaultappName
property.- See Also:
-
AUTO_COMMIT
DefaultautoCommit
property.- See Also:
-
BATCH_SIZE_SQLSERVER
DefaultbatchSize
property for SQL Server.- See Also:
-
BATCH_SIZE_SYBASE
DefaultbatchSize
property for Sybase.- See Also:
-
BIND_ADDRESS
DefaultbindAddress
property.- See Also:
-
BUFFER_MAX_MEMORY
DefaultbufferMaxMemory
property.- See Also:
-
BUFFER_MIN_PACKETS
DefaultbufferMinPackets
property.- See Also:
-
CACHEMETA
DefaultcacheMetaData
property.- See Also:
-
CHARSET
Defaultcharset
property.- See Also:
-
DATABASE_NAME
DefaultdatabaseName
property.- See Also:
-
INSTANCE
Defaultinstance
property.- See Also:
-
DOMAIN
Defaultdomain
property.- See Also:
-
LAST_UPDATE_COUNT
DefaultlastUpdateCount
property.- See Also:
-
LOB_BUFFER_SIZE
DefaultlobBufferSize
property.- See Also:
-
LOGIN_TIMEOUT
DefaultloginTimeout
property.- See Also:
-
MAC_ADDRESS
DefaultmacAddress
property.- See Also:
-
MAX_STATEMENTS
DefaultmaxStatements
property.- See Also:
-
NAMED_PIPE
DefaultnamedPipe
property.- See Also:
-
NAMED_PIPE_PATH_SQLSERVER
DefaultnamedPipePath
property for SQL Server.- See Also:
-
NAMED_PIPE_PATH_SYBASE
DefaultnamedPipePath
property for Sybase.- See Also:
-
PACKET_SIZE_42
DefaultpacketSize
property for TDS 4.2. -
PACKET_SIZE_50
DefaultpacketSize
property for TDS 5.0.- See Also:
-
PACKET_SIZE_70_80
DefaultpacketSize
property for TDS 7.0 and TDS 8.0.- See Also:
-
PASSWORD
Defaultpassword
property.- See Also:
-
PORT_NUMBER_SQLSERVER
DefaultportNumber
property for SQL Server.- See Also:
-
PORT_NUMBER_SYBASE
DefaultportNumber
property for Sybase.- See Also:
-
LANGUAGE
Defaultlanguage
property.- See Also:
-
PREPARE_SQLSERVER
DefaultprepareSql
property for SQL Server. -
PREPARE_SYBASE
DefaultprepareSql
property for Sybase. -
PROG_NAME
DefaultprogName
property.- See Also:
-
TCP_NODELAY
DefaulttcpNoDelay
property.- See Also:
-
BUFFER_DIR
DefaulttmpDir
property. -
USE_UNICODE
DefaultsendStringParametersAsUnicode
property.- See Also:
-
USECURSORS
DefaultuseCursors
property.- See Also:
-
USEJCIFS
DefaultuseJCIFS
property.- See Also:
-
USELOBS
DefaultuseLOBs
property.- See Also:
-
USENTLMV2
DefaultuseNTLMv2
property.- See Also:
-
USEKERBEROS
DefaultuseKerberos
property.- See Also:
-
USER
Defaultuser
property.- See Also:
-
WSID
Defaultwsid
property.- See Also:
-
XAEMULATION
DefaultXaEmulation
property.- See Also:
-
LOGFILE
Defaultlogfile
property.- See Also:
-
SOCKET_TIMEOUT
DefaultsockeTimeout
property.- See Also:
-
SOCKET_KEEPALIVE
DefaultsocketKeepAlive
property.- See Also:
-
PROCESS_ID
DefaultprocessId
property.- See Also:
-
SERVER_TYPE_SQLSERVER
DefaultserverType
property for SQL Server.- See Also:
-
SERVER_TYPE_SYBASE
DefaultserverType
property for Sybase.- See Also:
-
TDS_VERSION_42
Defaulttds
property for TDS 4.2.- See Also:
-
TDS_VERSION_50
Defaulttds
property for TDS 5.0.- See Also:
-
TDS_VERSION_70
Defaulttds
property for TDS 7.0.- See Also:
-
TDS_VERSION_80
Defaulttds
property for TDS 8.0.- See Also:
-
TDS_VERSION_90
Defaulttds
property for TDS 9.0.- See Also:
-
SSL
Defaultssl
property.- See Also:
-
tdsDefaults
Default TDS version based on server type -
portNumberDefaults
Default port number based on server type -
packetSizeDefaults
Default packet size based on TDS version -
batchSizeDefaults
Default max batch size based on server type -
prepareSQLDefaults
Default prepare SQL mode based on server type
-
-
Constructor Details
-
DefaultProperties
public DefaultProperties()
-
-
Method Details
-
addDefaultProperties
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
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(Properties props, String key, String defaultKey, 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
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:
IllegalArgumentException
- if an invalid serverType is given
-
getServerType
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
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
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
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.
-