当前位置:首页 > 数据库 > Sqlserver

php连接SQLSERVER的连接串中实例名的有关问题

php连接SQLSERVER 的连接串中实例名的问题
PHP code
 
$host='192.168.1.122';  --IP
$port=1433; --端口
$instanse = 't02'; --实例名
$username='sa';
$password='passss';
if (! $link = mssql_connect($host.':'.$port.$instanse, $username, $password) ) --这样写好像不对






122的这台SQLSERVER上有多个实例。现在不想连接默认实例,而想连接T02实例

在SSMS 里写法是 192.168.1.122,1433t02

SQLSERVER 的实例名写在哪? 上面的写法通不过


------解决方案--------------------
// Server in the this format: or
// , when using a non default port number
$server = 'KALLESPCSQLEXPRESS';

// Connect to MSSQL
$link = mssql_connect($server, 'sa', 'phpfi');

if (!$link) {
die('Something went wrong while connecting to MSSQL');
}
?>
【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!