mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
DNS-less connection examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@282626 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
013472b277
commit
6754c4a334
1 changed files with 28 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.7 $ -->
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<refentry xml:id="function.odbc-connect" xmlns="http://docbook.org/ns/docbook">
|
||||
<refnamediv>
|
||||
<refname>odbc_connect</refname>
|
||||
|
@ -39,7 +39,8 @@
|
|||
<term><parameter>dsn</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The database source name for the connection.
|
||||
The database source name for the connection. Alternatively, a
|
||||
DNS-less connection string can be used.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -108,6 +109,31 @@
|
|||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>DNS-less connections</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Microsoft SQL Server using the SQL Native Client 10.0 ODBC Driver - allows connection to SQL 7, 2000, 2005 and 2008
|
||||
$connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $password);
|
||||
|
||||
// Microsoft Access
|
||||
$connection = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$mdbFilename", $user, $password);
|
||||
|
||||
// Microsoft Excel
|
||||
$excelFile = realpath('C:/ExcelData.xls');
|
||||
$excelFir = dirname($excelFile);
|
||||
$connection = odbc_connect("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=$excelFile;DefaultDir=$excelDir" , '', '');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue