connection problem to MS Access database

Discussion in 'PHP' started by shino, Apr 26, 2006.

  1. #1
    I am trying to connect to ms access database

    using the code below
    $conn = odbc_connect("dsn_add", "", "") or die("Not Able To connect To Database ") ;

    But it is not connecting . but the same is connecting with cfm pages



    When directly connecting with the following code it is connecting
    $conn = odbc_connect("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . str_replace("/", "\\", $_SERVER["DOCUMENT_ROOT"]) . "/dir1/database1.mdb", "", "") or die("No reksha") ;


    But not able to insert, or update values
    then the error is coming like

    "Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query."


    Can any one help me in this problem

    Thanks

    Shino
     
    shino, Apr 26, 2006 IP
  2. Danny

    Danny Active Member

    Messages:
    732
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    78
    #2
    That error is not necesarrily a connection error

    support.microsoft.com/kb/q175168/

    The error usually means the dabase is read only or was not opened with the correct flag. i.e. was opened for reading

    It could also be that it was opened by a user without the correct permissions
     
    Danny, Apr 27, 2006 IP
  3. phd

    phd Active Member

    Messages:
    496
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Mostly this type of error I'm getting when the write permission is not there to IUSER_MACHINENAME of database or folder containing database, if you are using Windows.

    Set the write permission to user apache, if you are using Linux. :)
     
    phd, Apr 28, 2006 IP
  4. shino

    shino Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you for your help

    thanks
     
    shino, May 4, 2006 IP