note 42854 modified in function.odbc-connect by vincent
| From: | vincent@php.net | Date: | Mon, 28 Jun 2004 10:32:37 +0000 |
| Subject: | note 42854 modified in function.odbc-connect by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71990@lists.php.net to get a copy of this message | ||
To make a DSN-less connection using ODBC to MS-SQL:
<?php
$connection_string = 'DRIVER={SQL
Server};SERVER=<servername>;DATABASE=<databasename>';
$user = 'username';
$pass = 'password';
$connection = odbc_connect( $connection_string, $user, $pass );
?>
servername is the name of the database server
databasename is the name of the database
Note, I've only tried this from a windows box using the Microsoft ODBC drivers.
--was--
To make a DSN-less connection using ODBC to MS-SQL:
<?php
$connection_string = 'DRIVER={SQL
Server};SERVER=<servername>;DATABASE=<databasename>';
$user = 'username';
$pass = 'password';
$connection = odbc_connection( $connection_string, $user, $pass );
?>
servername is the name of the database server
databasename is the name of the database
Note, I've only tried this from a windows box using the Microsoft ODBC drivers.
http://php.net/manual/en/function.odbc-connect.php