我是 DB2 的新手。
$database = 'test';
$user = 'user1';
$password = 'pswd1';
$hostname = '10.250.10.10';
$port = 556;
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
$conn = db2_connect($conn_string, '', '');
if ($conn) {
echo "Connection succeeded.";
db2_close($conn);
}
else {
print($conn);
echo "Connection failed.";
die(db2_conn_errormsg());
}
所有的值都是正确的。但连接失败。请给我建议。以及如何检查 PHPINFO()。DB2 是否安装成功。
我收到以下错误
Connection failed.[unixODBC][Driver Manager]Data source name not found, and no default driver specified SQLCODE=0