- 论坛徽章:
- 0
|
折腾了一下午解决不了
现在情况是:
sybase-CT已经安装好了(装了sybase客户端)
pear:DB也工作正常(链接本地mysql没问题)
但是用pear链接sybase就是连不上
DB Error: connect failed
以下是源程序
<?php
// The pear base directory must be in your include_path
require_once 'DB.php';
$user = 'xxx';
$pass = 'xxx';
$host = 'xxx:xxx';
$db_name = 'xxx';
// Data Source Name: This is the universal connection string
$dsn = "sybase://$user:$pass@$host/$db_name";
// DB::connect will return a Pear DB object on success
// or a Pear DB Error object on error
// You can also set to TRUE the second param
// if you want a persistent connection:
// $db = DB::connect($dsn, true);
$db = DB::connect($dsn);
// With DB::isError you can differentiate between an error or
// a valid connection.
if (DB::isError($db)) {
die ($db->;getMessage());
}
// You can disconnect from the database with:
$db->;disconnect();
?>; |
|