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

[EMAIL PROTECTED]

www.bydesignllc.com

 

 

Reply via email to