简体   繁体   English

如何使用mssql连接到远程MS SQL Server

[英]how to connect to remote MS SQL Server using mssql

Trying to connect to a remote MS SQL server from a goDaddy server. 尝试从goDaddy服务器连接到远程MS SQL服务器。 The server I am trying to connect from does not have the PDO driver for SQL Server. 我尝试连接的服务器没有用于SQL Server的PDO驱动程序。 The only option I saw was using mssql. 我看到的唯一选择是使用mssql。 My connction code is as follows 我的连接代码如下

$server = 'xxx.xxx.xxx.xxx,1433'; //public IP of the SQL server

// Connect to MSSQL
$link = mssql_connect($server, 'username', '*******');

if (!$link) {
    die(mssql_get_last_message());
}

The connects fails every time. 每次连接都会失败。 Error Unable to connect to server. 错误无法连接到服务器。 There is a firewall in place on the Server host SQL Server but I whitelisted the goDaddy IP so that should not be an issue. 服务器主机SQL Server上有防火墙,但是我将goDaddy IP列入了白名单,所以这不是问题。 Also not seeing anything hit the firewall when I try the script. 当我尝试脚本时,也看不到任何东西击中防火墙。

Any advice would be welcome. 任何的建议都受欢迎。

Actually resolved it. 实际解决了。 GoDaddy gave you the ability to add mssql in the C-panel php settings but didn't actually have the drivers installed. GoDaddy使您能够在C-panel php设置中添加mssql,但实际上并未安装驱动程序。 So no connection was ever attempted with remote server 因此,从未尝试与远程服务器建立连接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM