- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 PHP 的 PDO 连接到 Sybase (SQL Anywhere 12) 数据库。我花了几个小时试图找到要使用的正确驱动程序和 DSN,但根本没有成功。每次我尝试编辑单个参数时,总是会出错。我尝试了数十种不同的 DSN 参数组合,没有任何 react 。我将在这里只报告一些只是为了给你我试图获得的例子。
我成功安装了 PDO 驱动程序 - 来自 php.ini:
PDO drivers dblib, mysql, odbc, pgsql
PDO Driver for FreeTDS/Sybase DB-lib enabled
Flavour freetds
'dblib:host=192.168.100.234;DBN=GAMMA01'
'dblib:host=192.168.100.234;DBN=GAMMA01;UID=dba;PWD=allright;Server=GAMMA01;ASTART=No'
new PDO('dblib:host=192.168.100.234;dbname=GAMMA01', 'dba', 'allright');
SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
log.c:190:Starting log file for FreeTDS 0.82
on 2014-04-08 13:40:40 with debug flags 0x4fff.
iconv.c:363:iconv to convert client-side data to the "ANSI_X3.4-1968" character set
iconv.c:516:tds_iconv_info_init: converting "US-ASCII"->"UCS-2LE"
iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
net.c:210:Connecting to 192.168.100.234 port 5200 (TDS version 7.0)
net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:299:getsockopt(2) reported: Connection refused
util.c:334:tdserror(0xb9a46eb0, 0xb9b60688, 20009, 115)
dblib.c:7782:dbperror(0xb9b5ff88, 20009, 115)
dblib.c:7835:20009: "Unable to connect: Adaptive Server is unavailable or does not exist"
dblib.c:5627:dbgetuserdata(0xb9b5ff88)
dblib.c:7856:"Unable to connect: Adaptive Server is unavailable or does not exist", client returns 2 (INT_CANCEL)
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
net.c:310:tds_open_socket() failed
dblib.c:1372:dbclose(0xb9b5ff88)
dblib.c:256:dblib_del_connection(0xb5ceea00, 0xb9b60688)
mem.c:563:tds_free_all_results()
dblib.c:303:dblib_release_tds_ctx(1)
dblib.c:5727:dbfreebuf(0xb9b5ff88)
dblib.c:718:dbloginfree(0xb9b46588)
'sybase:host=192.168.100.234;dbname=GAMMA01, dba, allright'
could not find driver
'odbc:Driver={Sybase SQL Anywhere 12};NA=192.168.100.234,5200;Uid=dba;Pwd=allright;'
'odbc:Driver={SQL Anywhere 12};NA=192.168.100.234,5200;Uid=dba;Pwd=allright;'
'odbc:DRIVER={Sybase SQL Anywhere 12};SRVR=192.168.100.234;DB=gamma01;UID=dba;PWD=allright;'
'odbc:DRIVER={Sybase SQL Anywhere 12};HOSTNAME=192.168.100.234;DATABASE=gamma01;UID=dba;PWD=allright;PROTOCOL:TCPIP'
SQLSTATE[IM002] SQLDriverConnect: 0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
最佳答案
"Data source name not found and no default driver specified."
错误意味着在 中找不到您指定的 DSN 或驱动程序。 odbc.ini ODBC 环境的文件。
您需要确保您的 ODBC 环境设置正确。通常,这包括 的位置和文件名的规范。 odbc.ini 文件。
尝试连接时,将搜索 odbc.ini 文件以查找匹配的数据源名称 (DSN)
在您的情况下,您指定的是“驱动程序”。这是通常在 中找到的类似配置。 odbcinst.ini 文件;也由您的 ODBC 环境指定。
要检查的另一件事是确保正在运行的进程或您的 PHP 应用程序的拥有用户找到 ODBC 环境。
关键是要弄清楚连接序列的哪一部分失败了。在您的情况下,成功的连接将遵循以下路径:
关于pdo - 使用 PDO 连接到 Sybase 的正确 DSN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22936157/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!