With PHP3 working fine with other odbc databases on a NT 4 machine running Apache as the web server, I'm trying to connect to a Pervasive SQL ODBC dsn connection and I'm getting the following error:

PHP 3 Warning: SQL error: Specified driver could not be loaded due to system error 5 (Pervasive ODBC Engine Interface)., SQL state IM003 in SQLConnect in d:\www\htdocs\testaccpac\listinvoices.php on line 22

from the odbc.ini file I see that I'm using
Driver32=d:\PROGRA~1\PVSW\Bin\w3odbcei.dll
as the dll for this particular dsn.

I'm using the following to produce the error:
$dsnname = "demodata";
if ($conn = odbc_connect($dsnname, "", "")) //line 22
//i've also tried the above with proper username and password with no success
{
echo "<br> success to DSN: " . $dsnname;
}
else
{
echo "<br> no success to DSN: " . $dsnname;
}

Testing the connection in 32 bit ODBC dialog works fine, and if I create an Access database on the server, and link to the ODBC connection, everything seems to work properly (ie I can see the data in the tables).

Has anyone seen this problem before? There is a similar post at
http://lists.omnipotent.net/php3/199903/msg02751.html
but that seems to be the only other reference I can find on the net.

Many thanks,
Aaron M.

    4 months later

    Kind of a general post, using pervasive as the example database:

    I'm using Win2k, IIS5, pervasive.sql, php4 w/ odbc built in.

    My first problem was getting php working with my virtual directory.

    Next I wanted to use a DSN to connect to a pervasive db that I had created. All it would do is hang.

    Next I tried to connect to an access db and I got errors.

    So I knew it had something to do with the web server. IIS5 runs as the un-privledged user IUSR_WIN2K, but both of my databases where expecting an administrative user.

    When I changed IIS to run as administrator, both odbc connections worked great. But this is a giant security hole.

    So I created the user 'bob'.

    Here's how I did it:

    Go into pervasive control center and look at the properties of the db in question.

    Go to the Security tab and establish a password for managing security for this database.

    This will set the password for the 'Master' user of THIS database, enter it twice and click APPLY.

    Then click OK and go into USERS, right click and click New User. Enter a username and password and set the appropriate permissions if you have pre-existing tables.

    The next time that you go into pervasive control center and try to work with tables, you'll be prompted for a username and password. If you gave this new user create table privledge, all of the tables could be built under this user.

    bob has a table called 'names' with fields 'first' and 'last'.


    Make sure you have a DSN for this pervasive database. ( I called mine test5 )


    Here's my test script:

    <?
    // connect to a DSN "test5" with username
    // and password
    $connect=odbc_connect('test5','bob','xxx');

    // query the 'names' table
    $query = "SELECT * FROM names";

    // perform the query
    $result = odbc_exec($connect, $query);

    // fetch the data from the database
    while(odbc_fetch_row($result)){
    $first = odbc_result($result, 1);
    print "$first<br>\n";
    }

    // close the connection
    odbc_close($connect);
    ?>


    I haven't tried Access yet, but I suspect that if you set up security on the database, in a similiar fashion to what I have done, you'll be able to query it in no time.

      4 months later

      I hava had the same problems. Turned out that you have to use an older version of Pervasive ODBC. I had version 2.53.03 installed with the application that uses Pervasive SQL. I found out that version 2.01 or something, worked just fine.

      Good luck!

      Jasper

        Write a Reply...