[Linux] PHP and SQL Server

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

 



Hi,

I'd like to connect to SQL Server (it is MSDE from SQL Server 2000) from
PHP.
My system is Debian.
I've installed FreeTDS and some dependencies...

Here is my /etc/freetds/freetds.conf :
[global]
        # TDS protocol version
        tds version = 4.2
[etemptation]
        host = 10.21.2.203
        port = 1433
        tds version = 8.0

Then, my /etc/odbc.ini :
[etemptation]
Description = TDS MSSQL Server
Driver = /usr/lib/odbc/libtdsodbc.so
Server = 10.21.2.203
Database = etemptation
Port = 1433
TDS_Version = 8.0

And, my /etc/odbcinst.ini :
[FreeTDS]
Description     = TDS driver (Sybase/MS SQL)
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so
CPTimeout       = 5
CPReuse         = 5
UsageCount      = 1

My PHP test page is :
<?php
$cnx = odbc_connect("etemptation", "idep", "password");
if(!$cnx)       {
        echo 'problem connexion';
}
else    {
        echo 'connexion OK';
        $sql ="SELECT * from HOPPOIN";
        $rs = odbc_exec($cnx,$sql);

        while(odbc_fetch_row($rs))      {

        }

        odbc_free_result($rs);
        odbc_close($cnx);
        echo 'connexion fermee';
}
?>

But the result is :
Warning: odbc_connect() [function.odbc-connect]: SQL error:
[unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL
state S1000 in SQLConnect in /home/david.bercot/Internet/test_mssql.php
on line 2 problem connexion

I've also tried in a shell :
p3010-ac-nantes:/home/david.bercot/Internet# isql -v etemptation
src/tds/login.c: tds_connect: 10.21.2.203:1433: Connexion refusée
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[08S01][unixODBC][FreeTDS][SQL Server]Server is unavailable or does not
exist. [ISQL]ERROR: Could not SQLConnect

Do you have any idea for my problem ?

Thank you very much.

David.

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux