Connecting to SQL Server
| From: | Todd Cary | Date: | Wed, 10 Aug 2005 17:52:08 +0000 |
| Subject: | Connecting to SQL Server | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-40050@lists.php.net to get a copy of this message | ||
I have been asked by my client to use SQL Server for my php application (uggggh!). The name of the server is "2k-server", but I am not sure where to create the ODBC connection. Some of the docs state that all I need is
<?php
$connection_string = 'DRIVER={SQL Server};SERVER=2K-SERVER;DATABASE=Php_Test';
$user = 'sa';
$pass = 'MyPassword';
$connection = odbc_connect( $connection_string, $user, $pass );
?>
However that gives me an error:
Warning: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/httpd/test/odbc/php/connect.php on line 8
Any suggestions on the best way to connect?
Todd