sybase_connect() and sybase_pconnect() APIs support DSN-style connection properties. When you call either of these APIs using only the servername parameter, servername must contain a valid DSN (data source name) string. The data source name is a semicolon (;) separated string of name=value parts as explained as follows:
Name – a case-insensitive value that can be delimited by an equal sign (=) or semicolon (;). An attribute can have multiple synonyms. For example, server and servername refer to the same attribute.
Equals sign (=) – indicates the start of the value to be assigned to the Name. If there is no equals sign, the Name is assumed to be of boolean type with a value of true.
Value – a string that is terminated by a semicolon (;). To skip the termination, use a backslash (\) if a semicolon or another back slash is present in the value. Values can be of type boolean, integer, or string. Valid values for boolean types are true, false, on, off, 1, and 0.
For example:
Username=name;Password=pwd;Timeout=10
The following table describes valid attribute names and values for the dsn keyword argument:
Name |
Description |
Value |
---|---|---|
ANSINull |
Determines whether evaluation of NULL-valued operands in SQL equality (=) or inequality (!=) comparisons is ANSI-compliant. If the value is true, Adaptive Server enforces the ANSI behavior that = NULL and is NULL are not equivalent. In standard Transact-SQL, = NULL and is NULL are considered to be equivalent. This option affects <> NULL and is not NULL behavior in a similar fashion. |
Boolean value. The default is false. |
BulkLogin |
Determines whether a connection is enabled to perform a bulk-copy operation. |
Boolean value. The default is false. |
ChainXacts |
If true, Adaptive Server uses chained transaction behavior, that is, each server command is considered to be a distinct transaction. Adaptive Server implicitly executes a begin transaction before any of these statements: delete, fetch, insert, open, select, and update. You must still explicitly end or roll back the transaction. If false, an application must specify explicit begin transaction statements paired with commit or rollback statements. |
Boolean value. The default is false. |
Charset |
Specifies the charset to be used on this connection. |
String value. |
Confidentiality |
Whether data encryption service is performed on the connection. |
Boolean value. The default is false. |
CredentialDelegation |
Determines whether to allow the server to connect to a second server with the user’s delegated credentials. |
Boolean value. The default is false. |
DetectReplay |
Determines whether the connection’s security mechanism detects replayed transmissions. |
Boolean value. The default is false. |
DetectOutOfSequence |
Determines whether the connection’s security mechanism detects transmissions that arrive out of sequence. |
Boolean value. The default is false. |
Integrity |
Determines whether the connection’s security mechanism performs data integrity checking. |
Boolean value. The default is false. |
Interfaces |
The path and name of the interfaces file. |
String value. |
Keytab |
The name and path to the file from which a connection’s security mechanism reads the security key to go with the username value. |
String value. The default is NULL, that is, the user must have established credentials before connecting. |
Locale |
Determines which language and character set to use for messages, datatype conversions, and datetime formats. |
String value. |
Language |
Determines which language set to use for messages, datatype conversions, and datetime formats. |
String value. |
LoginTimeout |
Specifies the login timeout value. |
Integer value. |
MaxConnect |
Specifies the maximum number of simultaneously open connections that a context may have. |
Integer value. Default value is 25. Negative and zero values are not allowed. |
MutualAuthentication |
Determines whether the server is required to authenticate itself to the client. |
Boolean value. The default is false. |
NetworkAuthentication |
Determines whether the connection’s security mechanism performs network-based user authentication. |
Boolean value. The default is false. |
PacketSize |
Specifies the TDS packet size. |
Integer value. |
Password |
Specifies the password used to log in to the server. |
String value. |
PasswordEncryption |
Determines whether the connection uses asymmetrical password encryption. |
Boolean value. The default is false. |
SecurityMechanism |
Specifies the name of the network security mechanism that performs security services for the connection. |
String value. The default value depends on security driver configuration. |
Server Servername |
Specifies the name of the server to which you are connected. |
String value. |
ServerPrincipalName |
Specifies the network security principal name for the server to which a connection is opened. |
String value. The default is NULL, which means that the connection assumes the server principal name is the same as its ServerName value. |
TDS_Keepalive |
Determines whether to use the KEEPALIVE option. |
Boolean value. The default is true. |
Timeout |
Specifies the connection timeout value. |
Integer value. |
UID User Username |
Specifies the name used to log in to the server. |
String value. |
The dsnconnect.php sample program connects to a server using a DSN connection string. It optionally prints the server name, the user account, and the current database.