[英]Using pdo_dblib to connect to the sybase failed
I want to use PDO to connect to a Sybase using PHP pdo_dblib
. 我想使用PDO使用PHP
pdo_dblib
连接到Sybase。 This is what I have done: 这就是我所做的:
$conn = new PDO("dblib:host=$db_host:$db_port;dbname=$db_name","$login","$password");
It shows me SQL Null error
. 它显示了
SQL Null error
。 I don't know how to get it right. 我不知道如何做对。 I have checked the php info, and the pdo_dblib is there.
我检查了php信息,pdo_dblib就在那里。
PDO Driver for FreeTDS/Sybase DB-lib: Flavour
enabled: freetds
by the way, is the database port needed? 顺便说一句,是否需要数据库端口? Before this, I didn't put the database port number, plus now I'm still unable to get the port number.
在此之前,我没有把数据库端口号,加上现在我仍然无法获得端口号。
Follow these steps to find the cause of the error 请按照以下步骤查找错误原因
Step1: Connecting using telnet. 第1步:使用telnet连接。
xxx@ubuntuvbox:~$ telnet 10.1.1.1 5000
Trying 10.1.1.1...
Connected to 10.1.1.1.
Step2: Configure FreeTDS 第2步:配置FreeTDS
Edit freetds.conf, located in /etc/freetds/ (Ubuntu 11.10) 编辑freetds.conf,位于/ etc / freetds /(Ubuntu 11.10)
[global]
# TDS protocol version
tds version = 5.0
text size = 64512
Step3: Connecting using FreeTDS 第3步:使用FreeTDS连接
xxx@ubuntuvbox:~$ sqsh -S 10.1.1.1:5000 -Usa
sqsh-2.1 Copyright (C) 1995-2001 Scott C. Gray
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
Password:
Msg 2401, Level 11, State 2
Server 'XXXXXX'
Character set conversion is not available between client character set 'utf8'
and server character set 'cp850'.
No conversions will be done.
1> select * from .....
Step4: Connecting using FreeTDS with PHP Step4:使用FreeTDS与PHP连接
Check this... 检查一下......
$dbh = new PDO ('dblib:host=10.1.1.1:5000;dbname=databasename','sa','password');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.