Page 1 of 1

Able to connect to Sybase via web, but not command line.

Posted: Thu Sep 23, 2010 1:31 pm
by max232
Greetings .


I'm trying trying to create simple shell scripts to run as cron jobs to pull from a SybAse db. I'm already doing this with a MySQL db. For any MySQL database I can connect both via a php webn page as well as command line via an .sh script.

I've installed the necassary extensions to connect to SYbase by way of a php web page. No probelm. But I can't connect via command line . The exmaple you'll see bellow works perfectly when embeded in a php web page, but if I try to run is as a .sh script...I simply get no results.

However, the same convention ...while replacing 'sybase' with 'mysql' works without a hitch.

#!/usr/bin/php
<?



@sybase_connect("db, 'user', 'pass')



or die("Could not connect !");

sybase_select_db("recip");

$result=sybase_query("Select distinct rcv_location.rcv_lic from rcv_location")
or die ("Cant get results");

while ($row=sybase_fetch_array($result))
{

$rcv_lic=$row['rcv_lic'];

echo "$rcv_lic\n";


}

?>