Home > Backend Development > PHP Tutorial > php连接SQLSERVER 的连接串中实例名的有关问题

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

WBOY
Release: 2016-06-13 10:10:43
Original
858 people have browsed it

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

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> $host='192.168.1.122';  --IP$port=1433; --端口$instanse = 't02'; --实例名$username='sa';$password='passss';if (! $link = mssql_connect($host.':'.$port.$instanse, $username, $password) ) --这样写好像不对
Copy after login


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

在SSMS 里写法是 192.168.1.122,1433\t02

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


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

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

if (!$link) {
die('Something went wrong while connecting to MSSQL');
}
?>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template