1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
|
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Revision: 330340 $ -->
<reference xml:id="ref.pdo-sqlsrv" xmlns="http://docbook.org/ns/docbook">
<title>Microsoft SQL Server Functions (PDO_SQLSRV)</title>
<titleabbrev>MS SQL Server (PDO)</titleabbrev>
<partintro>
<section xml:id="pdo-sqlsrv.intro">
&reftitle.intro;
<para>
PDO_SQLSRV is a driver that implements the <link linkend="intro.pdo">PHP
Data Objects (PDO) interface</link>
to enable access from PHP to MS SQL Server (starting with SQL Server 2005)
and SQL Azure databases.
</para>
</section>
&reference.pdo-sqlsrv.configure;
&reference.pdo-sqlsrv.constants;
</partintro>
<refentry xml:id="ref.pdo-sqlsrv.connection">
<refnamediv>
<refname>PDO_SQLSRV DSN</refname>
<refpurpose>Connecting to MS SQL Server and SQL Azure databases</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
The PDO_SQLSRV Data Source Name (DSN) is composed of the following elements:
<variablelist>
<varlistentry>
<term>DSN prefix</term>
<listitem>
<para>
The DSN prefix is <userinput>sqlsrv:</userinput>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>APP</literal></term>
<listitem>
<para>
The application name used in tracing.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>ConnectionPooling</literal></term>
<listitem>
<para>
Specifies whether the connection is assigned from a connection pool
(1 or &true;) or not (0 or &false;).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>Database</literal></term>
<listitem>
<para>
The name of the database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>Encrypt</literal></term>
<listitem>
<para>
Specifies whether the communication with SQL Server is encrypted
(1 or &true;) or unencrypted (0 or &false;).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>Failover_Partner</literal></term>
<listitem>
<para>
Specifies the server and instance of the database's mirror (if enabled
and configured) to use when the primary server is unavailable.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>LoginTimeout</literal></term>
<listitem>
<para>
Specifies the number of seconds to wait before failing the connection attempt.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>MultipleActiveResultSets</literal></term>
<listitem>
<para>
Disables or explicitly enables support for multiple active Result sets (MARS).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>QuotedId</literal></term>
<listitem>
<para>
Specifies whether to use SQL-92 rules for quoted identifiers (1 or &true;)
or to use legacy Transact-SQL rules (0 or false).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>Server</literal></term>
<listitem>
<para>
The name of the database server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>TraceFile</literal></term>
<listitem>
<para>
Specifies the path for the file used for trace data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>TraceOn</literal></term>
<listitem>
<para>
Specifies whether ODBC tracing is enabled (1 or &true;) or disabled
(0 or &false;) for the connection being established.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>TransactionIsolation</literal></term>
<listitem>
<para>
Specifies the transaction isolation level. The accepted values for this
option are PDO::SQLSRV_TXN_READ_UNCOMMITTED, PDO::SQLSRV_TXN_READ_COMMITTED,
PDO::SQLSRV_TXN_REPEATABLE_READ, PDO::SQLSRV_TXN_SNAPSHOT, and
PDO::SQLSRV_TXN_SERIALIZABLE.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>TrustServerCertificate</literal></term>
<listitem>
<para>
Specifies whether the client should trust (1 or &true;) or reject
(0 or &false;) a self-signed server certificate.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>WSID</literal></term>
<listitem>
<para>
Specifies the name of the computer for tracing.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>PDO_SQLSRV DSN examples</title>
<para>
The following example shows how to connecto to a specified MS SQL Server database:
<programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=localhost;Database=testdb", "UserName", "Password");
]]>
</programlisting>
</para>
<para>
The following example shows how to connect to a MS SQL Server database on
a specified port:
<programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=localhost,1521;Database=testdb", "UserName", "Password");
]]>
</programlisting>
</para>
<para>
The following example shows how to connecto to a SQL Azure database with
server ID 12345abcde. Note that when you connect to SQL Azure with PDO,
your username will be UserName@12345abcde (UserName@ServerId).
<programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=12345abcde.database.windows.net;Database=testdb", "UserName@12345abcde", "Password");
]]>
</programlisting>
</para>
</example>
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
|