MS SQL Server Connections

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Google Mike

    MS SQL Server Connections

    I have Red Hat 9. Anyone here have that too and can help me?

    Without having to do a lot of major surgery, such as recompiling my
    PHP (which I consider risky), I want to use either unixODBC or FreeTDS
    to connect RH9 Linux to MS SQL Server 2000.

    I noticed from phpinfo() that FreeTDS wasn't configured into the PHP
    install, although I have installed FreeTDS just now. That's probably
    why the mssql_connect() call won't connect -- says Call to undefined
    function. I probably need to recompile PHP (again, risky) in order to
    get this to work. However, I *DID* notice that unixODBC was enabled,
    so I wanted to connect with that using this code:

    $dsn = "Driver={SQ L Server};Server= 10.22.109.5;Dat abase=pubs";
    $user = 'sa';
    $pass = 'password';
    $link = odbc_cconnect($ dsn, $user, $pass);
    $sql = 'SELECT * FROM authors';
    $q = odbc_exec($link , $sql);
    $rec = odbc_fetch_arra y($q);
    echo $rec['au_lname'];
    odbc_free_resul t($q);

    Well, again, it says Call to undefined function odbc_connect().

    What's the catch? Is there a simple way out of this?
  • Jochen Daum

    #2
    Re: MS SQL Server Connections

    Hi !

    On 19 Nov 2003 13:50:45 -0800, googlemike@hotp op.com (Google Mike)
    wrote:
    [color=blue]
    >I have Red Hat 9. Anyone here have that too and can help me?
    >
    >Without having to do a lot of major surgery, such as recompiling my
    >PHP (which I consider risky), I want to use either unixODBC or FreeTDS
    >to connect RH9 Linux to MS SQL Server 2000.[/color]

    AFAIK, you canuse only extension on Linux, which are compiled in. You
    can have a look at dynamically loading them.
    But compiling is not risky at all.
    [color=blue]
    >
    >I noticed from phpinfo() that FreeTDS wasn't configured into the PHP
    >install, although I have installed FreeTDS just now. That's probably
    >why the mssql_connect() call won't connect -- says Call to undefined
    >function.[/color]

    The mssql extension is not loaded.
    [color=blue]
    >I probably need to recompile PHP (again, risky) in order to
    >get this to work. However, I *DID* notice that unixODBC was enabled,
    >so I wanted to connect with that using this code:[/color]

    never tried that, so cannot quite help.

    HTH, Jochen
    --
    Jochen Daum - CANS Ltd.
    PHP DB Edit Toolkit -- PHP scripts for building
    database editing interfaces.
    Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

    Comment

    Working...