Package net.sourceforge.jtds.jdbc
Class DefaultProperties
- java.lang.Object
-
- net.sourceforge.jtds.jdbc.DefaultProperties
-
public final class DefaultProperties extends java.lang.ObjectContainer for default property constants. This class also provides static utility methods forPropertiesandSettingsobjects. To add new properties to the jTDS driver, do the following:- Add
prop.fooandprop.desc.fooproperties toMessages.properties. - Add a
static finaldefault 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
DefaultPropertiesTestLibraryfor 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.StringAPP_NAMEDefaultappNameproperty.static java.lang.StringAUTO_COMMITDefaultautoCommitproperty.static java.lang.StringBATCH_SIZE_SQLSERVERDefaultbatchSizeproperty for SQL Server.static java.lang.StringBATCH_SIZE_SYBASEDefaultbatchSizeproperty for Sybase.private static java.util.HashMapbatchSizeDefaultsDefault max batch size based on server typestatic java.lang.StringBIND_ADDRESSDefaultbindAddressproperty.static java.lang.StringBUFFER_DIRDefaulttmpDirproperty.static java.lang.StringBUFFER_MAX_MEMORYDefaultbufferMaxMemoryproperty.static java.lang.StringBUFFER_MIN_PACKETSDefaultbufferMinPacketsproperty.static java.lang.StringCACHEMETADefaultcacheMetaDataproperty.static java.lang.StringCHARSETDefaultcharsetproperty.static java.lang.StringDATABASE_NAMEDefaultdatabaseNameproperty.static java.lang.StringDOMAINDefaultdomainproperty.static java.lang.StringINSTANCEDefaultinstanceproperty.static java.lang.StringLANGUAGEDefaultlanguageproperty.static java.lang.StringLAST_UPDATE_COUNTDefaultlastUpdateCountproperty.static java.lang.StringLOB_BUFFER_SIZEDefaultlobBufferSizeproperty.static java.lang.StringLOGFILEDefaultlogfileproperty.static java.lang.StringLOGIN_TIMEOUTDefaultloginTimeoutproperty.static java.lang.StringMAC_ADDRESSDefaultmacAddressproperty.static java.lang.StringMAX_STATEMENTSDefaultmaxStatementsproperty.static java.lang.StringNAMED_PIPEDefaultnamedPipeproperty.static java.lang.StringNAMED_PIPE_PATH_SQLSERVERDefaultnamedPipePathproperty for SQL Server.static java.lang.StringNAMED_PIPE_PATH_SYBASEDefaultnamedPipePathproperty for Sybase.static java.lang.StringPACKET_SIZE_42DefaultpacketSizeproperty for TDS 4.2.static java.lang.StringPACKET_SIZE_50DefaultpacketSizeproperty for TDS 5.0.static java.lang.StringPACKET_SIZE_70_80DefaultpacketSizeproperty for TDS 7.0 and TDS 8.0.private static java.util.HashMappacketSizeDefaultsDefault packet size based on TDS versionstatic java.lang.StringPASSWORDDefaultpasswordproperty.static java.lang.StringPORT_NUMBER_SQLSERVERDefaultportNumberproperty for SQL Server.static java.lang.StringPORT_NUMBER_SYBASEDefaultportNumberproperty for Sybase.private static java.util.HashMapportNumberDefaultsDefault port number based on server typestatic java.lang.StringPREPARE_SQLSERVERDefaultprepareSqlproperty for SQL Server.static java.lang.StringPREPARE_SYBASEDefaultprepareSqlproperty for Sybase.private static java.util.HashMapprepareSQLDefaultsDefault prepare SQL mode based on server typestatic java.lang.StringPROCESS_IDDefaultprocessIdproperty.static java.lang.StringPROG_NAMEDefaultprogNameproperty.static java.lang.StringSERVER_TYPE_SQLSERVERDefaultserverTypeproperty for SQL Server.static java.lang.StringSERVER_TYPE_SYBASEDefaultserverTypeproperty for Sybase.static java.lang.StringSOCKET_KEEPALIVEDefaultsocketKeepAliveproperty.static java.lang.StringSOCKET_TIMEOUTDefaultsockeTimeoutproperty.static java.lang.StringSSLDefaultsslproperty.static java.lang.StringTCP_NODELAYDefaulttcpNoDelayproperty.static java.lang.StringTDS_VERSION_42Defaulttdsproperty for TDS 4.2.static java.lang.StringTDS_VERSION_50Defaulttdsproperty for TDS 5.0.static java.lang.StringTDS_VERSION_70Defaulttdsproperty for TDS 7.0.static java.lang.StringTDS_VERSION_80Defaulttdsproperty for TDS 8.0.static java.lang.StringTDS_VERSION_90Defaulttdsproperty for TDS 9.0.private static java.util.HashMaptdsDefaultsDefault TDS version based on server typestatic java.lang.StringUSE_UNICODEDefaultsendStringParametersAsUnicodeproperty.static java.lang.StringUSECURSORSDefaultuseCursorsproperty.static java.lang.StringUSEJCIFSDefaultuseJCIFSproperty.static java.lang.StringUSEKERBEROSDefaultuseKerberosproperty.static java.lang.StringUSELOBSDefaultuseLOBsproperty.static java.lang.StringUSENTLMV2DefaultuseNTLMv2property.static java.lang.StringUSERDefaultuserproperty.static java.lang.StringWSIDDefaultwsidproperty.static java.lang.StringXAEMULATIONDefaultXaEmulationproperty.
-
Constructor Summary
Constructors Constructor Description DefaultProperties()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.PropertiesaddDefaultProperties(java.util.Properties props)Add default properties to thepropsproperties object.private static voidaddDefaultPropertyIfNotSet(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 voidaddDefaultPropertyIfNotSet(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 thedefaultKeyand thedefaultsmap to determine the correct value.static java.lang.StringgetNamedPipePath(int serverType)Returns the default path for the named pipe for a given serverType.static java.lang.StringgetServerType(int serverType)Converts an integer server type to its string representation.static java.lang.IntegergetServerType(java.lang.String serverType)Converts a string server type to its integer representation.static java.lang.StringgetServerTypeWithDefault(int serverType)Same asgetServerType(int), only it returns the default server type ("sqlserver") ifserverTypeis 0.static java.lang.IntegergetTdsVersion(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
DefaultappNameproperty.- See Also:
- Constant Field Values
-
AUTO_COMMIT
public static final java.lang.String AUTO_COMMIT
DefaultautoCommitproperty.- See Also:
- Constant Field Values
-
BATCH_SIZE_SQLSERVER
public static final java.lang.String BATCH_SIZE_SQLSERVER
DefaultbatchSizeproperty for SQL Server.- See Also:
- Constant Field Values
-
BATCH_SIZE_SYBASE
public static final java.lang.String BATCH_SIZE_SYBASE
DefaultbatchSizeproperty for Sybase.- See Also:
- Constant Field Values
-
BIND_ADDRESS
public static final java.lang.String BIND_ADDRESS
DefaultbindAddressproperty.- See Also:
- Constant Field Values
-
BUFFER_MAX_MEMORY
public static final java.lang.String BUFFER_MAX_MEMORY
DefaultbufferMaxMemoryproperty.- See Also:
- Constant Field Values
-
BUFFER_MIN_PACKETS
public static final java.lang.String BUFFER_MIN_PACKETS
DefaultbufferMinPacketsproperty.- See Also:
- Constant Field Values
-
CACHEMETA
public static final java.lang.String CACHEMETA
DefaultcacheMetaDataproperty.- See Also:
- Constant Field Values
-
CHARSET
public static final java.lang.String CHARSET
Defaultcharsetproperty.- See Also:
- Constant Field Values
-
DATABASE_NAME
public static final java.lang.String DATABASE_NAME
DefaultdatabaseNameproperty.- See Also:
- Constant Field Values
-
INSTANCE
public static final java.lang.String INSTANCE
Defaultinstanceproperty.- See Also:
- Constant Field Values
-
DOMAIN
public static final java.lang.String DOMAIN
Defaultdomainproperty.- See Also:
- Constant Field Values
-
LAST_UPDATE_COUNT
public static final java.lang.String LAST_UPDATE_COUNT
DefaultlastUpdateCountproperty.- See Also:
- Constant Field Values
-
LOB_BUFFER_SIZE
public static final java.lang.String LOB_BUFFER_SIZE
DefaultlobBufferSizeproperty.- See Also:
- Constant Field Values
-
LOGIN_TIMEOUT
public static final java.lang.String LOGIN_TIMEOUT
DefaultloginTimeoutproperty.- See Also:
- Constant Field Values
-
MAC_ADDRESS
public static final java.lang.String MAC_ADDRESS
DefaultmacAddressproperty.- See Also:
- Constant Field Values
-
MAX_STATEMENTS
public static final java.lang.String MAX_STATEMENTS
DefaultmaxStatementsproperty.- See Also:
- Constant Field Values
-
NAMED_PIPE
public static final java.lang.String NAMED_PIPE
DefaultnamedPipeproperty.- See Also:
- Constant Field Values
-
NAMED_PIPE_PATH_SQLSERVER
public static final java.lang.String NAMED_PIPE_PATH_SQLSERVER
DefaultnamedPipePathproperty for SQL Server.- See Also:
- Constant Field Values
-
NAMED_PIPE_PATH_SYBASE
public static final java.lang.String NAMED_PIPE_PATH_SYBASE
DefaultnamedPipePathproperty for Sybase.- See Also:
- Constant Field Values
-
PACKET_SIZE_42
public static final java.lang.String PACKET_SIZE_42
DefaultpacketSizeproperty for TDS 4.2.
-
PACKET_SIZE_50
public static final java.lang.String PACKET_SIZE_50
DefaultpacketSizeproperty for TDS 5.0.- See Also:
- Constant Field Values
-
PACKET_SIZE_70_80
public static final java.lang.String PACKET_SIZE_70_80
DefaultpacketSizeproperty for TDS 7.0 and TDS 8.0.- See Also:
- Constant Field Values
-
PASSWORD
public static final java.lang.String PASSWORD
Defaultpasswordproperty.- See Also:
- Constant Field Values
-
PORT_NUMBER_SQLSERVER
public static final java.lang.String PORT_NUMBER_SQLSERVER
DefaultportNumberproperty for SQL Server.- See Also:
- Constant Field Values
-
PORT_NUMBER_SYBASE
public static final java.lang.String PORT_NUMBER_SYBASE
DefaultportNumberproperty for Sybase.- See Also:
- Constant Field Values
-
LANGUAGE
public static final java.lang.String LANGUAGE
Defaultlanguageproperty.- See Also:
- Constant Field Values
-
PREPARE_SQLSERVER
public static final java.lang.String PREPARE_SQLSERVER
DefaultprepareSqlproperty for SQL Server.
-
PREPARE_SYBASE
public static final java.lang.String PREPARE_SYBASE
DefaultprepareSqlproperty for Sybase.
-
PROG_NAME
public static final java.lang.String PROG_NAME
DefaultprogNameproperty.- See Also:
- Constant Field Values
-
TCP_NODELAY
public static final java.lang.String TCP_NODELAY
DefaulttcpNoDelayproperty.- See Also:
- Constant Field Values
-
BUFFER_DIR
public static final java.lang.String BUFFER_DIR
DefaulttmpDirproperty.
-
USE_UNICODE
public static final java.lang.String USE_UNICODE
DefaultsendStringParametersAsUnicodeproperty.- See Also:
- Constant Field Values
-
USECURSORS
public static final java.lang.String USECURSORS
DefaultuseCursorsproperty.- See Also:
- Constant Field Values
-
USEJCIFS
public static final java.lang.String USEJCIFS
DefaultuseJCIFSproperty.- See Also:
- Constant Field Values
-
USELOBS
public static final java.lang.String USELOBS
DefaultuseLOBsproperty.- See Also:
- Constant Field Values
-
USENTLMV2
public static final java.lang.String USENTLMV2
DefaultuseNTLMv2property.- See Also:
- Constant Field Values
-
USEKERBEROS
public static final java.lang.String USEKERBEROS
DefaultuseKerberosproperty.- See Also:
- Constant Field Values
-
USER
public static final java.lang.String USER
Defaultuserproperty.- See Also:
- Constant Field Values
-
WSID
public static final java.lang.String WSID
Defaultwsidproperty.- See Also:
- Constant Field Values
-
XAEMULATION
public static final java.lang.String XAEMULATION
DefaultXaEmulationproperty.- See Also:
- Constant Field Values
-
LOGFILE
public static final java.lang.String LOGFILE
Defaultlogfileproperty.- See Also:
- Constant Field Values
-
SOCKET_TIMEOUT
public static final java.lang.String SOCKET_TIMEOUT
DefaultsockeTimeoutproperty.- See Also:
- Constant Field Values
-
SOCKET_KEEPALIVE
public static final java.lang.String SOCKET_KEEPALIVE
DefaultsocketKeepAliveproperty.- See Also:
- Constant Field Values
-
PROCESS_ID
public static final java.lang.String PROCESS_ID
DefaultprocessIdproperty.- See Also:
- Constant Field Values
-
SERVER_TYPE_SQLSERVER
public static final java.lang.String SERVER_TYPE_SQLSERVER
DefaultserverTypeproperty for SQL Server.- See Also:
- Constant Field Values
-
SERVER_TYPE_SYBASE
public static final java.lang.String SERVER_TYPE_SYBASE
DefaultserverTypeproperty for Sybase.- See Also:
- Constant Field Values
-
TDS_VERSION_42
public static final java.lang.String TDS_VERSION_42
Defaulttdsproperty for TDS 4.2.- See Also:
- Constant Field Values
-
TDS_VERSION_50
public static final java.lang.String TDS_VERSION_50
Defaulttdsproperty for TDS 5.0.- See Also:
- Constant Field Values
-
TDS_VERSION_70
public static final java.lang.String TDS_VERSION_70
Defaulttdsproperty for TDS 7.0.- See Also:
- Constant Field Values
-
TDS_VERSION_80
public static final java.lang.String TDS_VERSION_80
Defaulttdsproperty for TDS 8.0.- See Also:
- Constant Field Values
-
TDS_VERSION_90
public static final java.lang.String TDS_VERSION_90
Defaulttdsproperty for TDS 9.0.- See Also:
- Constant Field Values
-
SSL
public static final java.lang.String SSL
Defaultsslproperty.- 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 thepropsproperties object.- Parameters:
props- The properties object.- Returns:
- The updated
propsobject, ornullif theserverTypeproperty 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 thedefaultKeyand thedefaultsmap 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 ofdefaultKeyvalues to the correctkeyvalue 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.SQLSERVERorDriver.SYBASEor0(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
nullif 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
nullif unknown
-
getServerTypeWithDefault
public static java.lang.String getServerTypeWithDefault(int serverType)
Same asgetServerType(int), only it returns the default server type ("sqlserver") ifserverTypeis 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
nullif unknown.
-
-