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

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

Jun 13, 2016 pm 01:47 PM
connect mssql port server sqlserver

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');
}
?>
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem that the object named already exists in the sqlserver database How to solve the problem that the object named already exists in the sqlserver database Apr 05, 2024 pm 09:42 PM

How to solve the problem that the object named already exists in the sqlserver database

How to import mdf file into sqlserver How to import mdf file into sqlserver Apr 08, 2024 am 11:41 AM

How to import mdf file into sqlserver

What to do if the sqlserver service cannot be started What to do if the sqlserver service cannot be started Apr 05, 2024 pm 10:00 PM

What to do if the sqlserver service cannot be started

Where is the sqlserver database? Where is the sqlserver database? Apr 05, 2024 pm 08:21 PM

Where is the sqlserver database?

How to recover accidentally deleted database in sqlserver How to recover accidentally deleted database in sqlserver Apr 05, 2024 pm 10:39 PM

How to recover accidentally deleted database in sqlserver

How to check sqlserver port number How to check sqlserver port number Apr 05, 2024 pm 09:57 PM

How to check sqlserver port number

How to delete sqlserver if the installation fails? How to delete sqlserver if the installation fails? Apr 05, 2024 pm 11:27 PM

How to delete sqlserver if the installation fails?

How to change sqlserver English installation to Chinese How to change sqlserver English installation to Chinese Apr 05, 2024 pm 10:21 PM

How to change sqlserver English installation to Chinese

See all articles