Monday, March 26, 2012

How to connect to a remote database ?

Hello,

First, sorry for my bad English.

Here is my problem:

BoxA: XPpro + Apache + php (using php_mssql.php)+ ADOdb + MS SQL Server
+ My_Prog (using local MS SQL PUBS database)

BoxB: NT4 + Apache + php (using php_mssql.php)+ ADOdb + My_Prog (using
remote BoxA PUBS database)

BoxC: W2K

My_Prog uses:
$serveur = '10.0.0.1'; BoxA's IP address
$admin_nom = 'sa';
$admin_mdp = '';
$base = 'PUBS';

$conn = &ADONewConnection($sgbd);
$conn->debug = true;
$a = $conn->Connect ($serveur,$admin_nom,$admin_mdp,$base);

From BoxC, using IE, connecting to:
- BoxA My_Prog : I access PUBS, that's OK
- BoxB My_prog : "Warning: mssql_connect(): message: Echec de la
connexion de l'utilisateur 'sa'. Raison : Non associ une connexion
scurise SQL Server. (severity 14) in ...\adodb-mssql.inc.php on line
438." (I prefer to report the "French" message)

Anyone knows about ?

Thanks in advance,
EricEricP <eric.piquot@.wanadoo.fr> wrote in message news:<bvqrdf$6ri$1@.news-reader3.wanadoo.fr>...
> Hello,
> First, sorry for my bad English.
> Here is my problem:
> BoxA: XPpro + Apache + php (using php_mssql.php)+ ADOdb + MS SQL Server
> + My_Prog (using local MS SQL PUBS database)
> BoxB: NT4 + Apache + php (using php_mssql.php)+ ADOdb + My_Prog (using
> remote BoxA PUBS database)
> BoxC: W2K
> My_Prog uses:
> $serveur = '10.0.0.1'; BoxA's IP address
> $admin_nom = 'sa';
> $admin_mdp = '';
> $base = 'PUBS';
> $conn = &ADONewConnection($sgbd);
> $conn->debug = true;
> $a = $conn->Connect ($serveur,$admin_nom,$admin_mdp,$base);
>
> From BoxC, using IE, connecting to:
> - BoxA My_Prog : I access PUBS, that's OK
> - BoxB My_prog : "Warning: mssql_connect(): message: Echec de la
> connexion de l'utilisateur 'sa'. Raison : Non associ une connexion
> scurise SQL Server. (severity 14) in ...\adodb-mssql.inc.php on line
> 438." (I prefer to report the "French" message)
> Anyone knows about ?
> Thanks in advance,
> Eric

The error message suggests that MSSQL is configured to accept only
Windows logins. I don't know anything about PHP, but is it possible
that your connection string is somehow being ignored, and PHP is
making a trusted connection instead of using the sa login and
password? If Apache on BoxA is running as a local administrator
account, for example, then by default it would be able to connect
using a trusted connection. But Apache on BoxB connecting to MSSQL on
BoxA would be running under a different account, and so could not
connect.

But that's more or less a guess - if it doesn't help, you may want to
post some extra information. MSSQL version, authentication mode
(Windows or Mixed), service accounts used by Apache etc. You might
also want to use sp_who to verify that when BoxA connects, it is
connecting as sa, and not as some other (perhaps Windows) account.

Simonsql

No comments:

Post a Comment