Skip to main content This browser is no longer supported. Show Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. sqlsrv_connect
In this articleDownload PHP driverCreates a connection resource and opens a connection. By default, the connection is attempted using Windows Authentication. Syntax
Parameters$serverName: A string specifying the name of the server to which a connection is being established. An instance name (for example, "myServer\instanceName") or port number (for example, "myServer, 1521") can be included as part of this string. For a complete description of the options available for this parameter, see the Server keyword in the ODBC Driver Connection String Keywords section of Using Connection String Keywords with SQL Native Client. Beginning in version 3.0 of the Microsoft Drivers for PHP for SQL Server, you can also specify a LocalDB instance with Also beginning in version 3.0 of the Microsoft Drivers for PHP for SQL Server, you can specify a virtual network name, to connect to an Always On availability group. For more information about Microsoft Drivers for PHP for SQL Server support for Always On availability groups, see Support for High Availability, Disaster Recovery. $connectionInfo [OPTIONAL]: An associative array that contains connection attributes (for example, array("Database" => "AdventureWorks")). See Connection Options for a list of the supported keys for the array. Return ValueA PHP connection resource. If a connection cannot be successfully created and opened, false is returned. RemarksIf values for the UID and PWD keys are not specified in the optional $connectionInfo parameter, the connection will be attempted using Windows Authentication. For more information about connecting to the server, see How to: Connect Using Windows Authentication and How to: Connect Using SQL Server Authentication. ExampleThe following example creates and opens a connection using Windows Authentication. The example assumes that SQL Server and the AdventureWorks database are installed on the local computer. All output is written to the console when the example is run from the command line.
See AlsoSQLSRV Driver API Reference Connecting to the Server About Code Examples in the Documentation FeedbackSubmit and view feedback for Lompati ke konten utama Browser ini sudah tidak didukung. Mutakhirkan ke Microsoft Edge untuk memanfaatkan fitur, pembaruan keamanan, dan dukungan teknis terkini. sqlsrv_connect
Dalam artikel iniDownload PHP driver Creates a connection resource and opens a connection. By default, the connection is attempted using Windows Authentication. Syntax
Parameters$serverName: A string specifying the name of the server to which a connection is being established. An instance name (for example, "myServer\instanceName") or port number (for example, "myServer, 1521") can be included as part of this string. For a complete description of the options available for this parameter, see the Server keyword in the ODBC Driver Connection String Keywords section of Using Connection String Keywords with SQL Native Client. Beginning in version 3.0 of the Microsoft Drivers for PHP for SQL Server, you can also specify a LocalDB instance with Also beginning in version 3.0 of the Microsoft Drivers for PHP for SQL Server, you can specify a virtual network name, to connect to an Always On availability group. For more information about Microsoft Drivers for PHP for SQL Server support for Always On availability groups, see Support for High Availability, Disaster Recovery. $connectionInfo [OPTIONAL]: An associative array that contains connection attributes (for example, array("Database" => "AdventureWorks")). See Connection Options for a list of the supported keys for the array. Return ValueA PHP connection resource. If a connection cannot be successfully created and opened, false is returned. RemarksIf values for the UID and PWD keys are not specified in the optional $connectionInfo parameter, the connection will be attempted using Windows Authentication. For more information about connecting to the server, see How to: Connect Using Windows Authentication and How to: Connect Using SQL Server Authentication. ExampleThe following example creates and opens a connection using Windows Authentication. The example assumes that SQL Server and the AdventureWorks database are installed on the local computer. All output is written to the console when the example is run from the command line.
See AlsoSQLSRV Driver API Reference Connecting to the Server About Code Examples in the Documentation Saran dan KomentarKirim dan lihat umpan balik untuk |