odbc_connect (PHP + MSSQL) problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Filipe Tomita

    #1

    odbc_connect (PHP + MSSQL) problems

    Hi all,

    I have tried connect to remote MS SQL server with no success. Anyone
    help me?

    ###this is the code used to try connect

    $dsn = "Driver={SQ L Server};Server= 200.xxx.xxx.xxx ;Database=Mydb; ";
    $user = 'WebService';
    $pass = 'triad';

    if(odbc_connect ($dsn, $user, $pass)){
    echo "I got it!.";
    }


    ###This is the error

    Warning: odbc_connect() [function.odbc-connect]: SQL error:
    [unixODBC][Driver Manager]Data source name not found, and no default
    driver specified, SQL state IM002 in SQLConnect in
    /home/triadbra/public_html/desenvolvimento/digs/teste2.php on line 8

    anyone have any idea to solve this problem? i have a linux server with
    PHP and a remote sql server

  • Jari Jokinen

    #2
    Re: odbc_connect (PHP + MSSQL) problems

    Filipe Tomita <filipe.tomita@ gmail.com> wrote:
    [color=blue]
    > [unixODBC][Driver Manager]Data source name not found[/color]

    I suppose you have unixODBC installed and data source name configured
    for Microsoft SQL Server? Next step is to tell PHP where it can find
    your ODBC configuration file:

    putenv('ODBCINI =/path/to/odbc.ini');

    Also make sure that your web server has permission to read that file.

    --
    Jari

    Comment

    Working...