CPAN has everything. Nearly everything and one of the modules is DBD::Sybase which connects to Microsoft SQL servers as well as Sybase ASE and iAnywhere servers, but there's a trick.
Every Sybase ASE server has a name (which is NOT the hostname!), assinged during installation. It's written to the /opt/sybase/interfaces file on the server and prepended to the service names (_XP, _BS and others). The file may be in another location if you changed the Sybase home directory during installation. Here is the content of my interfaces file:
SYASE master tcp ether ase 5000 query tcp ether ase 5000My server is called SYASE and this server name has to be part of the DBI connect string. Here is a sample:
SYASE_BS master tcp ether ase 5001 query tcp ether ase 5001
SYASE_MS master tcp ether ase 5002 query tcp ether ase 5002
SYASE_XP master tcp ether ase 5003 query tcp ether ase 5003
SYASE_JSAGENT master tcp ether ase 4900 query tcp ether ase 4900
dbi:Sybase:server=SYASE;host=ase.project.internal;port=5000;database=db_name;tdsLevel=CS_TDS_50;language=us_englishThe TDS level should be optional, it may be left from the times where I used FreeTDS instead of Sybase OpenClient and the language is important if the server doesn't know your OS or login default language. The other parts are:
- SYASE - the server's name as shown above
- ase.project.internal - the servers's hostname or IP address
- 5000 - the port where the server is listening for incoming connections. 5000 is Sybase default, I think.
- db_name - the database name which should be opened on the server
You may also copy the interfaces file to your clients Sybase home directory (environment variable SYBROOT ), but you may have to update the server's hostname. The host and port options should become optional when using a correct interfaces file.
PS: Thanks to mattp and riba for asking the question which made me write this answer.