The following must be added to the connection string to identify the sql.ini or interfaces file. You can connect to a single Directory Services URL (DSURL) or to multiple DSURLs.
For a single DSURL for ADO.NET, ODBC, and the OLE DB drivers and providers, you must add the following properties to the connection string in the following format:
DSURL=file://[path]<filename>[?][servicename]
where:
path (optional) is the path to the interfaces file. If not specified, %SYBASE%\ini is used as the default path on Windows and $SYBASE on Linux and Mac OS X.
filename is the name of the interface file.
On Windows, the interfaces file is typically named sql.ini.
On UNIX, the interfaces file is typically named interfaces.
servicename (optional) is the name of the service defined by the DSURL, also known as the server name.
If not defined in the DSURL, the server property in the connection string is used.
If both service name and server exist, the service name will be used.
If neither of them exist, the driver or provider loads the server information from the sql.ini or interfaces file, if the sql.ini or interfaces file has only one entry. If more than one entry exists in the file, an error is returned.
ODBC error example:
[Sybase][ODBC Driver]Getting more than one servers with the connect string.
Therefore the servicename or server property should always be defined in the connection URL, as typically interfaces files will contain multiple server entries.
Examples of the connection string for Windows and UNIX:
DSURL=file://sql.ini?mango1
where:
path is omitted in the above example, hence %SYBASE%/ini is used as the default path. However, if %SYBASE% is defined as C:\Sybase, then C:\Sybase\ini will be the path used.
filename is sql.ini.
servicename is mango1.
DSURL=file://\\myServer\myShare\sql.ini?mango1
where:
path is specified as \\myServer\myShare, which is a Universal Naming Convention (UNC) path that refers to a network shared directory.
filename is sql.ini.
servicename is mango1.
DSURL=file://interfaces?mango1
where:
path is omitted in the above example, hence $SYBASE is used as the default path. However, if $SYBASE is defined as /usr/sybase, then /usr/sybase will be the path used.
filename is interfaces.
servicename is mango1.
DSURL=file:///remote/sybase/interfaces?mango1
where:
path is specified as /remote/sybase
filename is interfaces.
servicename is mango1.
DSURL can support multiple LDAP URLs and interfaces files. Sybase also supports a multiple URL with mixed LDAP URLs and file URLs. When multiple URLs are used, the driver processes the URLs one by one until it successfully opens an interfaces file or connects to an LDAP server.
The following are examples of using multiple URLs in a connection string:
DSURL={file:///mils1/sybase/sql.ini;file:///test/interface}
DSURL={ldap://SYBLDAP:389/dc=sybase,dc=com??one?sybaseServername=MANGO; file:///test/interface?MANGO}
For information on the format of the interfaces file, see the Adaptive Server Enterprise Configuration Guide for your platform.