Re: PHP and SQL 2000

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

The default way to connect is to use SQL Server user names and passwords,
but the mssql extension can be configured to use secure/trusted
connections. This is don by setting mssql.secure_connection = On in
php.ini.

With a secure connection the client maschine will use the userid/password
for the user who runs the php script (in this case that would be the user
configured under the web server)

- Frank


> hi there,
>  
>  i have been trying to connect to a sql 2000 server database. I am able
to connect using the DSN-connection: i.e., the following code works:
> <?php
> $dsn = "btc";
> $user = "";
> $password = "";
> $sqlconnect = odbc_connect ($dsn, $user, $password);
> $sqlquery = "SELECT FullDescrp FROM BTCCode3;";
> $process = odbc_exec ($sqlconnect, $sqlquery);
> echo $sqlquery;
> echo "<br><br>";
> while (odbc_fetch_row ($process))
> {
>    $Description = odbc_result($process, "FullDescrp");
>    echo "$Description <br>";
> }
> odbc_close ($sqlconnect);
> ?>
>  
> But when i try to connect to the database using the mssql_xxxx functions
like:
> <?php
> $dsn = "btc";
> $user = "";
> $password = "";
> $myDB = "BACSDB_test";
> $sqlconnect = mssql_connect ("$localhost", $user, $password);
> $sqldb = mssql_select_db($myDB, $sqlconnect) or die("Couldn't open
database $myDB");
> $sqlquery = "SELECT FullDescrp FROM BTCCode3;";
> $result = mssql_query ($sqlquery);
> echo $sqlquery;
> echo "<br><br>";
> while ($row = mssql_fetch_array ($result))
> {
>    echo $row['FullDescrp']."<br>\n";
> }
> mssql_close ($sqlconnect);
> ?>
>  
> It is not getting conencted. The following error is given:
> "Warning: mssql_connect(): message: Login failed for user '(null)'.
Reason: Not associated with a trusted SQL Server connection. (severity 14)
in c:\program files\apache group\apache\htdocs\btc_test.php on line 8
> 
> Warning: mssql_connect(): Unable to connect to server: in c:\program
files\apache group\apache\htdocs\btc_test.php on line 8
> 
> Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link
resource in c:\program files\apache group\apache\htdocs\btc_test.php on
line 9
> Couldn't open database BACSDB_test"
>  
> Please help....
> Any help received will be highly appreciated.
>  
> thanks
> penjo
> 
> Yahoo! India Matrimony: Find your life partneronline.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux