Reply
PHP & MSSQL 2 Servers
Old 09-27-2004, 11:29 AM PHP & MSSQL 2 Servers
Junior Talker

Posts: 4
Trades: 0
I have apache, php running on a windows 2000 machine accessing a MSSQL7 server, everthing is running ok. I am now trying to access another MSSQL7 server and have set the odbc connect the same as the first connection and it runs the test ok, I can also run the query analyser tool on the apache, php server and connect to the 2 MSSQL Server, but I can't get PHP to bring any data back when i change the php to point to this new data source.


Any help appreciated

Cheers

Last edited by dassa; 09-29-2004 at 04:20 AM..
dassa is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 09-27-2004, 09:38 PM
WebcyteDesign's Avatar
Registered User

Posts: 159
Location: Hamilton
Trades: 0
I'd need to see the SQL statement and if there are errors comming up, also, this could be a stupid question, but, is there any data in the SQL server.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 09-28-2004, 05:07 AM
Junior Talker

Posts: 4
Trades: 0
The sql statement works fine on the first server and the second server has the same tables, Im using the example Northwind database as a basic test and the sql select * from customers works fine when I use Query Analyser on the new server.

My thinking is there is a permissions problem within php as i can access the database via any other method.


<?php
odbc_close_all;

$odbc_dsn = "test";
$odbc_userid = "";
$odbc_password = "";

$query = "select * from customers";

if(!($odbc_db = odbc_connect("test","","")))
die("could not connect to ODBC Data Source $odbc_dsn");

if(!($odbc_rs = odbc_do($odbc_db, $query)))
die("Error executing $query");

while ($result = odbc_result_all($odbc_rs))
{odbc_result ( $odbc_rs, 1 );

?>
<TABLE border=1 width=925>
<TR>
<TD width =100><font size="2" face="tahoma, Berlin Sans FB Demi"><SMALL><? echo $odbc_rs; ?></font></TD>
</TR>
</TABLE>
<?}

Last edited by dassa; 09-28-2004 at 11:24 AM..
dassa is offline
Reply With Quote
View Public Profile
 
Old 09-29-2004, 04:52 AM Error Message
Junior Talker

Posts: 4
Trades: 0
I have now manged to get the below error message.

Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'DOMAIN\COMPUTERNAME$'., SQL state 28000 in SQLConnect in c:\program files\apache group\apache\htdocs\auth\db\test.php on line 9 could not connect to ODBC Data Source test.

I don't quite understand why the error message states the login failed for user Domain and then Computer name rather than Domain and the user i'm logged in as Administrator ?
dassa is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP & MSSQL 2 Servers
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.09601 seconds with 13 queries