The following attributes are currently supported when connecting to a server.
Attributes |
Description |
---|---|
server |
Specifies the server to which you are connecting. The driver currently assumes this option is set. If server is not specified, use the ENV{"DSQUERY"} mechanism to obtain a server name. |
database |
Specifies which database within the server is the target database at connect time. If no database is specified, the master database is used. |
hostname |
Specifies, in the value section, the host name that is stored in the sysprocesses table for this process. If no hostname is specified, the host on which the Perl application executes is used. |
language |
Specifies the locale to be used on this connection. If no language is specified, the internal default locale named CS_LC_ALL is used. |
charset |
Specifies the charset to be used on this connection. If no charset is specified, the internal default that is, utf8, is used. |
host; port |
Specifies the combination of host and port to use instead of relying on the interfaces file entries. Note:
In the Perl DSN syntax, host and port are separate options. An alternative DSN
form similar to the following is not currently supported:
host:port=mumbles:1234 When the host and port DSN options are provided with the intent of not using the interface file, the host and port must suffice to connect. If the DSN attribute “server=” is also provided with the host and port combination, the connection fails. Therefore, the usage of either host and port must be used to establish a connection or server alone must be used. The two DSN attributes (server versus host/port) are mutually exclusive. |
timeout |
Specifies the connection timeout value. Set to 0 or a negative value for no timeout. |
loginTimeout |
Specifies the login timeout value, in seconds. The default value is 60 seconds. Set loginTimeout=value in seconds to enable this attribute. |
tds_keepalive |
Specifies the KEEP_ALIVE attribute on the connection. Set tds_keepalive=1 to enable this attribute. |
packetSize |
Specifies the TDS packet size for the connection. By default, the lower bound, which is set in the driver, is 2048. The maximum value is determined by the server, and is not set in the driver. |
maxConnect |
Increases or decreases the number of connections allowed. The range of values is 1 – 128; the default is 25. |
encryptPassword |
Specifies whether to use password encryption. Set encryptPassword=1 to enable this attribute. |
sslCAFile |
Specifies an alternate location for the trusted.txt file. Specify an absolute path of up to 256 characters. |
scriptName |
Specifies the chosen name of the top-level Perl script that drives the application. This name appears in the sysprocesses table as the application name. Absence of this value gives a default application name that is obtained from the Perl internal environment. This value can be as many as 256 characters. Note:
The application name fed into the SybaseASE Driver is either set through the DSN
scriptName option or is derived from the Perl internal
environment.
|
interfaces |
Specifies an alternate location to the Sybase interfaces file. Same constraints apply to the sslCAFile and scriptName options. |
You can repeat attribute values as long as they are recognized by the driver. Illegal attributes cause the DBI->connect() call to fail.
DSN-specific example:
$dbh = DBI->connect("dbi:SybaseASE:server=mumbles", $user, $passwd);
Alternatively, use the DSQUERY environment variable:
my $srv = $ENV{"DSQUERY"}; $dbh = DBI->connect("dbi:SybaseASE:server=$srv", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:host=tzedek.sybase.com;port=8100", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:maxConnect=100", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:database=sybsystemprocs", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:charset=iso_1", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:language=us_english", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:packetSize=8192", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:interfaces=/opt/sybase/interfaces", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:loginTimeout=240", $user, $passwd); $dbh = DBI->connect("dbi:SybaseASE:timeout=240", $user, $passwd); $dbh = DBI->connect("dbi:Sybase:scriptName=myScript", $user, $password); $dbh = DBI->connect("dbi:SybaseASE:hostname=pedigree", $user, $password); $dbh = DBI->connect("dbi:SybaseASE:encryptPassword=1", $user, $password); $dbh = DBI>connect("dbi:SybaseASE:sslCAFile=/usr/local/sybase/trusted.txt", $user, $password, AutoCommit => 1);
DSN-specific example combination:
$dbh = DBI->connect("dbi:SybaseASE:server=mumbles, database=tempdb;packetSize=8192; language=us_english;charset=iso_1;encryptPassword=1", $user, $pwd, AutoCommit=>1, PrintError => 0);
The following DSN syntax are not supported currently:
tdsLevel
kerberos; for example:
$dbh = DBI->connect("dbi:SybaseASE:kerberos=$serverprincipal", '', '');
bulkLogin; for example:
$dbh = DBI->connect("dbi:SybaseASE:bulkLogin=1", $user, $password);
serverType