Ask Experts Questions for FREE Help !
Ask
    AhShan's Avatar
    AhShan Posts: 6, Reputation: 1
    New Member
     
    #1

    Aug 2, 2006, 11:50 PM
    PHP Connection Problem with ODBC After Moving out from Local Machine
    In the following, Section 1 was my original code. The php code connected with an Access file was running Apache server in my local machine, and they did work fine.

    However, after moving the php and Access file to a web server, and changed $db='W:\\EmpRosterDev\\UserDB.mdb'; in the php, it gets an error message. Please see Section 2.




    Section 1:
    -----------

    <?php

    $db='C:\\Documents and Settings\\My Documents\\IT\\UserList\\EmployeeList\\User_Demo1. mdb';

    $conn = new COM('ADODB.Connection');

    // Connection
    $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");

    $sql = 'SELECT... ';
    $rs = $conn->Execute($sql);

    ...



    Section 2
    -----------
    Warning: Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x768 Thread 0x6b4 DBC 0xaac5fc Jet'. In C:\htdocs\dt_util\EmpRosterDev\DevEmpRoster.php on line 44


    Could someone tell me how to fix this problem?

    Thanks in advance,

    Shan
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #2

    Aug 5, 2006, 04:34 AM
    Almost missed this one...

    Anyway, what path are you assigning as $db in your file that you are uploading to your web server? The path returned in the error message doesn't look right to me.

    You're code looks fine to me. I don't often connect to MS Access databases from PHP (tend to use MySQL) but your code matches this articles:
    https://www.askmehelpdesk.com/progra...ine-30752.html
    AhShan's Avatar
    AhShan Posts: 6, Reputation: 1
    New Member
     
    #3

    Aug 5, 2006, 09:30 AM
    Quote Originally Posted by LTheobald
    Almost missed this one...

    Anyway, what path are you assigning as $db in your file that you are uploading to your web server? The path returned in the error message doesn't look right to me.

    You're code looks fine to me. I don't often connect to MS Access databases from PHP (tend to use MySQL) but your code matches this articles:
    https://www.askmehelpdesk.com/progra...ine-30752.html
    Hi,

    Thank you for your response. I have changed my path in two different ways:

    1. $db='./User_Demo1.mdb';
    2. $db='User_Demo1.mdb';

    However, both didn't work. It gets an error message as below:

    'Warning: Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x52c Thread 0x43c DBC 0xaac5fc Jet'. In C:\htdocs\dt_util\EmpRosterDev\DevEmpRoster.php on line 44"

    Please give me some comments. Also, I can't open the article you referred to. Would you please send me again. Thanks a lot.

    Shan
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #4

    Aug 6, 2006, 11:59 PM
    The article link was meant to be:
    http://aspn.activestate.com/ASPN/Coo.../Recipe/123709

    As for the error message troubles, I'll look into it some more tonight but I think this might be more of a web server configuration issue. The folder the Access database is stored in might not have the correct rights for it to be queried by PHP.
    AhShan's Avatar
    AhShan Posts: 6, Reputation: 1
    New Member
     
    #5

    Aug 7, 2006, 09:25 AM
    Thank you very much for time answering my questions. I'll also check with my server provider if their server support MS Access. Thanks a lot for your advice.

    AhShan
    AhShan's Avatar
    AhShan Posts: 6, Reputation: 1
    New Member
     
    #6

    Aug 7, 2006, 09:42 PM
    Quote Originally Posted by LTheobald
    The article link was meant to be:
    http://aspn.activestate.com/ASPN/Coo.../Recipe/123709

    As for the error message troubles, I'll look into it some more tonight but I think this might be more of a web server configuration issue. The folder the Access database is stored in might not have the correct rights for it to be queried by PHP.
    Thanks for your help LTheobald. The previous error, registry key seems to be fixed.

    The new error is now as below:

    "Warning: Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'. In C:\htdocs\dt_util\EmpRosterDev\DevEmpRoster.php on line 44

    Warning: Invoke() failed: Exception occurred. Source: ADODB.Connection Description: Operation is not allowed when the object is closed. In C:\htdocs\dt_util\EmpRosterDev\DevEmpRoster.php on line 56"

    I'd like to give more info about the current condition of the related files:

    1. All file is stored in one folder under this directory - \\corpwebapp02\dt_util\EmpRosterDev

    2. In the folder(EmpRosterDev), there are 4 files and 1 folder. DevEmpRoster.php, intra_style.php, map.php, and UserDB.mdb. The folder contains 4 maps in jpg format.

    3. The currently connection between the DevEmpRoster.php and the UserDB.mdb:

    <?php
    $db='./UserDB.mdb';
    $conn = new COM('ADODB.Connection');
    $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db");
    $sql = 'Select ....';
    $rs = $conn->Execute($sql);
    $rs = $conn->Execute($sql);
    ?>

    4. I look at the Security tab in UserDB.mdb properties. The current Goup or user names:

    i) Administrators (Corpwebapp02\Administrator)
    ii) Dev Team (corporated\dev Team)

    Permissions for group i & ii are allowed to have full control, modify, read & execute, read and write.


    iii) Internet Guest Account (Corpwebapp02 \IUSR_Corpwebapp.....)

    iv) Peter (Peter@Corporate)

    v)web-dt (Corporate\web-dt)

    Permissions for group iii, iv & v do not have full control but are allowed to have modify, read & execute, read and write.

    I'm sorry for the long message. I don't understand why the error message still says "Could not find file '(unknown)'. In C:\htdocs\dt_util\"? I just realized that "C:\htdocs" is the path I save for User.DB in my local machine. Why even though all the file is moved to the webserver, DevEmpRoster.php still looks up the .mdb file in my local machine? That's really a confusing part.

    Thank you again for your patient to read my long message.

    Rinda
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #7

    Aug 8, 2006, 12:48 AM
    From the looks of the error messages, your code still cannot see the Access files. Try removing the "./" in front of your DB name. I don't think that's needed in a Windows environment and might be causing the problem.

    I don't have Access here at work but I do at home so I'll give your code a shot when I get back tonight and see what happens.
    AhShan's Avatar
    AhShan Posts: 6, Reputation: 1
    New Member
     
    #8

    Aug 9, 2006, 08:45 AM
    Hi LTheobald,

    You are such a nice professional. This particular problem is fixed. You're right my code couldn't find the Access file. It needs a function to get the current path. It works now with:

    $db=getcwd().'\UserDB.mdb';

    However, the code still has two bugs that need to be fixed. So far, I don't have idea yet. If you have chance, would you please give me some comments for the following two questions?

    Q#1: If running local Apache, the "include" function in the .php file works well as below:

    - include('intra_style.php');

    However, it gets errors running in the webserver. Can I use the function "getcwd()" with "include()" together? If so, how should it be? Or could "include_path" be my option?


    Q#2. Similar situation to Q#1, the following URL worked fine in the local Apache before. Please see below:

    echo '<a href = http://desktop/new/EmpRosterDev/map.php?afloor=$floor&locx=$locx&locy=$locy&fname= $fname&lname=$lname> $cubenum </a>'<br>";


    But it gets errors and could not open the map.php. Again, I saved all the files in one folder. I've tried many ways. Please see below: (but no one works! )

    1. $path=getcwd().;
    echo <a href='$path/map.php?. '> </a>?

    2. <a href='./map.php?. '>
    3. <a href='map.php?. '>


    Thank you for your patient again on my long questions.

    AhShan

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Problem installing win XP home on new machine [ 2 Answers ]

I put this in the OS section, hoping I will get more responses here: I have just built a new machine MSI MOBO, AMD sempron 64 3000+, 1 GB RAM, the MOBO has onboard GFX and it has a SATA HDD. The initial boot is fine, I get the blue screen when win xp starts to install. When I get to the...

Problem installing win XP home on new machine [ 1 Answers ]

I have just built a new machine MSI MOBO, AMD sempron 64 3000+, 1 GB RAM, the MOBO has onboard GFX and it has a SATA HDD. The initial boot is fine, I get the blue screen when win xp starts to install. When I get to the press f6 if you want to install 3rd party drivers (which I want to do)...

Wireless connection problem [ 6 Answers ]

Does anybody know why my PC and Samsung d500 can't receive each other? My wireless keyboard and mouse worked fine, also I can't see the infra red program anywhere on control panel. My PC is only around 7 months old and cost £1300 so its not old or cheap and is called philips ls1200. Maybe it's the...

Wahing Machine drain problem [ 1 Answers ]

Hey folks, First time homeowner overwhelmed by his plumbing. My washing machine drain keeps backing up during the spin cycle. I had rotorooter come out to look for clogs, but they said there was no blockage, only a faulty installation of the drainage which does not allow the pump to filter...

Tub drain (dap out) connection problem [ 6 Answers ]

After gutting and remodeling my guest bath I went to install a new tub drain though an access panel I have to the pit in my slab. Reading through the posts I think this is called the dap out. My new tub drain kit came with new pipes so when I went to unscrew the top collar on my dap out pipe,...


View more questions Search