"Adaptive Server不可用或不存在".从PHP连接到SQL Server时出错 [英] "Adaptive Server is unavailable or does not exist" error connecting to SQL Server from PHP

查看:1391
本文介绍了"Adaptive Server不可用或不存在".从PHP连接到SQL Server时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用unixODBC和FreeTDS从Mac连接到我的Mac上的SQL Server 2005数据库,正如我概述的

I'm attempting to connect to a SQL Server 2005 DB from my Mac using unixODBC and FreeTDS as I have outlined here. However, when I try to connect in to a different DB using the same setup, I get:

Connection Failed:[FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist.

这是我的freetds.conf设置:

Here is my freetds.conf setup:

[my_db]
host = 12.34.56.789
port = 1433
tds version = 8.0

这是我的odbc.ini:

And here is my odbc.ini:

[my_dsn]
Driver = /opt/local/lib/libtdsodbc.so
Description = My Database
Trace = no
Servername = my_db
Database = MyDB

[ODBC Data Sources]
my_dsn = FreeTDS

我仍然可以连接到我在这台计算机上设置的另一个数据库(在上面链接的博客文章中进行了介绍),因此,我很确定该错误不在Mac端.我已在服务器上验证我使用的IP地址和端口正确.对可能是什么问题以及是否在服务器端有任何想法?

I am still able to connect to the other DB I set up on this computer (described in my blog post linked above), so I'm pretty sure that the error isn't on the Mac end. I've verified on the server that I'm using the correct IP address and port. Any thoughts on what could be the problem, and if it's on the server end?

推荐答案

1.查看有关SQL Server的信息

tsql -LH SERVER_IP_ADDRESS

locale is "C"
locale charset is "646"
ServerName TITAN
InstanceName MSSQLSERVER
IsClustered No
Version 8.00.194
tcp 1433
np \\TITAN\pipe\sql\query

2.设置您的freetds.conf

tsql -C    
freetds.conf directory: /usr/local/etc

[TITAN]
host = SERVER_IP_ADDRESS
port = 1433
tds version = 7.2

3试试

tsql -S TITAN -U user -P password

 'dsn' => 'dblib:host=TITAN:1433;dbname=YOURDBNAME',

另请参见 http://www.freetds.org/userguide/confirminstall.htm (示例3-5.)

如果收到消息20009,请记住您尚未连接到计算机.这是配置或网络问题,而不是协议故障.确认服务器已启动,具有FreeTDS正在使用的名称和IP地址,并且正在侦听配置的端口.

If you get message 20009, remember you haven't connected to the machine. It's a configuration or network issue, not a protocol failure. Verify the server is up, has the name and IP address FreeTDS is using, and is listening to the configured port.

这篇关于"Adaptive Server不可用或不存在".从PHP连接到SQL Server时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆