MS SQL
| From: | Oscar J. Ramos | Date: | Fri, 14 Jan 2005 17:26:16 +0000 |
| Subject: | MS SQL | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-14992@lists.php.net to get a copy of this message | ||
Having problems connecting to MS SQL Server.
Here is my coding below.
Running IIS 6 on Windows 2003 Server. PHP 5 installed.
----CODE-----
<?
$db = new COM("ADODB.Connection");
$dsn = "DRIVER={SQL Server};
SERVER={<SERVER>};UID={<user>};PWD={<password>}; DATABASE={<DB>}";
$db->Open($dsn);
$rs = $db->Execute("SELECT * FROM <table>");
while (!$rs->EOF)
{
echo $rs->Fields['<field name>']->Value."<BR>";
$rs->MoveNext();
}
?>
------ END CODE -----
Here is the error I'm getting.
------ ERROR MESSAGE ------
Fatal error: Uncaught exception 'com_exception' with message 'Source:
Microsoft OLE DB Provider for ODBC Drivers
Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
for user 'administrator'. Reason: Not associated with a trusted SQL
Server connection.' in d:\www.bydesignllc.com\sql2.php:5 Stack trace: #0
d:\www.bydesignllc.com\sql2.php(5): com->Open('DRIVER={SQL Ser...') #1
{main} thrown in d:\www.bydesignllc.com\sql2.php on line 5
PHP Fatal error: Uncaught exception 'com_exception' with message
'Source: Microsoft OLE DB Provider for ODBC Drivers
Description: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
for user 'administrator'. Reason: Not associated with a trusted SQL
Server connection.' in d:\www.bydesignllc.com\sql2.php:5 Stack trace: #0
d:\www.bydesignllc.com\sql2.php(5): com->Open('DRIVER={SQL Ser...') #1
{main} thrown in d:\www.bydesignllc.com\sql2.php on line 5
------END --------
Can anyone help.
Oscar J. Ramos
Technology Support Technician
By Design LLC.
(212) 500 - 4466
x4466
ojramos@bydesignllc.com
www.bydesignllc.com