Announcement

Collapse
No announcement yet.

PHP Connection string

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Connection string

    I'm trying to connect to an Access database using PHP...long story. The ADODB connection string I'm using works fine on my laptop with IIS but online I get the following error:

    Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x80c Thread 0x58f4 DBC 0x10a30ffc Jet'.' in D:\inetpub\vhosts\tellymania.com\httpdocs\test0.ph p:6 Stack trace: #0 D:\inetpub\vhosts\tellymania.com\httpdocs\test0.ph p(6): com->Open('DRIVER={Microso...') #1 {main} thrown in * snip path to file *on line 6

    The code:

    line 5: $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
    line 6: $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". ("D:\inetpub\vhosts\tellymania.com\private\db2.mdb ").";");


    Is this a permissions error? I'm sure I got the path to the database right. What connection string would work?

  • #2
    Originally posted by Phatman View Post
    I'm trying to connect to an Access database using PHP...long story. The ADODB connection string I'm using works fine on my laptop with IIS but online I get the following error:

    Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x80c Thread 0x58f4 DBC 0x10a30ffc Jet'.' in D:\inetpub\vhosts\tellymania.com\httpdocs\test0.ph p:6 Stack trace: #0 D:\inetpub\vhosts\tellymania.com\httpdocs\test0.ph p(6): com->Open('DRIVER={Microso...') #1 {main} thrown in * snip path to file *on line 6

    The code:

    line 5: $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
    line 6: $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=". ("D:\inetpub\vhosts\tellymania.com\private\db2.mdb ").";");


    Is this a permissions error? I'm sure I got the path to the database right. What connection string would work?
    This does sound like a permissions problem, I've corrected it on your domain, also you can give a try rather with using a DSN.

    You can have a look at the following for more info on Access connection string:

    ## Access Connection String Samples - ConnectionStrings.com
    ## PHP Database ODBC

    ## Microsoft Access Database Connectivity PHP recipes ActiveState Code
    Rock _a.k.a._ Jack Daniel

    Follow eUKhost on Twitter || Join eUKhost Community on Facebook

    Comment


    • #3
      Ok, sorted it. I decided to go for OLEDB for performance but I had to escape the back slashes in the path to the database with double back slashes

      Comment


      • #4
        Originally posted by Phatman View Post
        Ok, sorted it. I decided to go for OLEDB for performance but I had to escape the back slashes in the path to the database with double back slashes
        Glad to hear that :wink:
        Rock _a.k.a._ Jack Daniel

        Follow eUKhost on Twitter || Join eUKhost Community on Facebook

        Comment

        Working...
        X