To connect from win32 to Sybase on Unix , you can use sybase open client and make sure to use the hostname in sybase_connect as it is defined in the OC sql.ini file .. it worked that way !
(PHP 4, PHP 5)
sybase_connect — Abre uma conexão Sybase
$servername
[, string $username
[, string $password
[, string $charset
[, string $appname
]]]]] ) : resourceRetorna: um identificador de recurso Sybase positivo em caso de sucesso ou um
FALSE
em caso de falha.
sybase_connect() estabelece uma conexão com um servidor Sybase. O argumento servername tem que ser um nome de servidor que é definido no arquivo 'interfaces'.
Se uma segunda chamada é feita ao sybase_connect() com os mesmos argumentos nenhum novo recurso será estabelecido. Ao invés disto, o identificador de recurso do recurso já aberto será retornado.
O recurso com o servidor será fechado tão logo a execução do script termine, a não ser que ele seja fechado anteriormente ao se chamar explicitamente o sybase_close().
Exemplo #1 Exemplo sybase_connect()
<?php
$link = sybase_connect('SYBASE', '', '')
or die("Could not connect !");
print ("Connected successfully");
sybase_close($link);
?>
Veja também sybase_pconnect() e sybase_close().
To connect from win32 to Sybase on Unix , you can use sybase open client and make sure to use the hostname in sybase_connect as it is defined in the OC sql.ini file .. it worked that way !
If you are having trouble connecting to your sybase database on unix, try checking that the SYBASE environmental variable is set correctly. I was getting connection errors until I found out that this variable had not been set through the server.
To decrease the level of messages sent back from the dbserver (such as 'changed context...') try:
sybase_min_server_severity(11);
freetds is a great, free tool to access your sybase tables with PHP. The setup can be a bit tricky. Use the following to put the environment variables that you need:
<?php
putenv ("SYBASE=/usr/local/freetds");
putenv ("SYBPLATFORM=linux");
putenv ("LD_LIBRARY_PATH=/usr/local/freetds/lib");
putenv ("LC_ALL=default");
putenv ('PATH=\"/usr/local/freetds/bin:$PATH\"');
putenv ("DSQUERY=SYBASE");
?>
Even if not using freetds, you'll need those env vars to make any sybase connection work. Another option is to just load them into your box from the command line.