DSN-less Problems - MS SQL server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Jones

    DSN-less Problems - MS SQL server

    Hi,

    I have MS SQL Server set up on a win2k box (and am running
    my PHP scripts on the same box that
    SQL Server is on) ... not connected to a network and
    just using the command line version of PHP ... (no web server)

    I set up ODBC with a DSN for the login and password I installed in SQLServer

    I set up the DSN for "local" i.e. on the local server
    (I also tried it using the server name (in this case TASK5E01 with similar
    results)
    using ADOdb with a few drivers that reqire a DSN ... it all works fine.
    This worked fine for example:

    $db =& ADONewConnectio n('odbc_mssql') ;
    $db->PConnect('test 1');

    where test1 is the DSN I set up for ... local ... tomjones ... and password


    However I tried the DSNless versions as follows:

    $dsn = "Driver={SQ L Server};Server= localhost;Datab ase=northwind;" ;
    $db->Connect($dsn,' tomjones','pass word');

    this fails with the following error:

    C:\php1>php tlj4_DSNless.ph p
    PHP Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL
    Server]Login fa
    iled for user 'tomjones'. Reason: Not associated with a trusted SQL Server
    conne
    ction., SQL state 28000 in SQLConnect in
    C:\php1\adodb\d rivers\adodb-odbc.inc.ph
    p on line 164
    PHP Fatal error: Call to undefined function: close() in
    C:\php1\tlj4_DS Nless.p
    hp on line 31

    SO I went one step further and loaded the native PHP mssql stuff and ran it
    as follows:

    $dsn = mssql_connect(" localhost", 'tomjones','pas sword') or die
    ("mssql_conn ect failed"); //test PHP mssql directly


    with the following identical result:

    C:\php1>php tlj4_native.php
    PHP Warning: mssql_connect() : message: Login failed for user 'tomjones'.
    Reason
    : Not associated with a trusted SQL Server connection. (severity 14) in
    C:\php1\
    tlj4_native.php on line 13
    PHP Warning: mssql_connect() : Unable to connect to server: localhost in
    C:\php
    1\tlj4_native.p hp on line 13

    SOOO --- what is up with this ... it must be a windows thing or the
    DSNless stuff just won't work. I did some searching and found lots of
    people
    complaining about this error but the fixes they suggested didn't work ... I
    am thinking it is a MS SQL Server set up issue but what is the point
    of DSNlessness if one still has the tune the DBMS in order to get
    connected ... why not just stick with ODBC which works. I wanted to be able
    to connect without the hastles of using some MS GUI to set stuff up.

    Thoughts? ... ideas for tests to run? ... suggestions on setting
    up MS SQL Server or win2k to get around this?

    As a work around, does anyone know how to set up ODBC DSNs under
    program control in order to bypass the GUI?

    thanks for wading though this ...

    Tom


  • Tom Jones

    #2
    Re: DSN-less Problems - MS SQL server

    I found a reference saying change the default ... mssql.secure_co nnection =
    off ... to on in the php.ini file.

    I tried it and now the native PHP mssql stuff works ... ADOdb is still a
    problem but looking into whether a similar fix will work.

    Tom


    "Tom Jones" <tomjones@lucen t.com> wrote in message
    news:brnscm$js1 @netnews.proxy. lucent.com...


    Comment

    Working...