Results 1 to 5 of 5

Thread: Connect ADO to db with password

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    4

    Talking

    Hi,

    I've been struggling with this problem for awhile and was wondering if some of you VB/database gurus out there could help me out with it.

    I am trying to connect my ADO control to an Access 97 db that has a password. The goal is to be able to connect to this Access db with my application on machines that don't necessarily have Access installed.

    I'm trying to use the connection string property of the ADO control and Microsoft Jet 3.51 OLE DB Provider. When the db doesn't have a password I have no trouble connecting to it with the following code:

    adoTestDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51; " & "Persist Security Info=False;" & "Data Source=" & App.Path & "\Test.mdb"


    However, when the db has a password, I start running into problems. When I enter the following information in the Data Link Properties window:
    I. Provider:
    Microsoft Jet 3.51 OLE DB Provider
    II. Connection:
    1. I select the db "test.mdb"
    2. I enter the username ("Admin") and the password

    When I Test the connection I get the error:
    "Test connection failed because of an error initializing provider. Can't start your application. The workgroup info file is missing or opened exclusively by another user."

    The thing is I have the system.mdw file on my system in C:\Windows\System (just where Access created it) and I don't have the db opened (I don't even have Access opened).

    Do you have any idea where I could be going wrong on this?

    As an extra tidbit, I have been able to successfully connect to the db with a password using the OLE Provider for ODBC Drivers, but when I go to install my application on the NT machine without Access 97, I get an error when it tries to open the db.

    What do you think?

    Thank you in advance,
    Jen


  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb

    Just refer to this Thread
    where I've replied.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 1999
    Posts
    4
    Thank you Chris! I had reviewed quite a few messages on this discussion board about connecting to a password protected db but only those in the Database forum so I had missed that message which was exactly my question (though worded much more succinctly!). I'll give your suggestion a try right now.

    Also, I was able to get the ODBC provider to work -- I think the quotation marks required in the extended properties tripped me up. Here's the code that worked:

    adoTestDB.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=True;Extended Properties=" & Chr(34) & "DBQ=" & App.Path & DB_FILE_NAME & ";DefaultDir=" & App.Path & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;ImplicitCommitSync=Yes;MaxBufferSize=512;MaxScanRows=8;PageTimeout=5;PWD=" & PASSWORD & ";SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;" & Chr(34)

    Where DB_FILE_NAME and PASSWORD are constants.

    Since this is pretty new to me when I got the error message that stated:
    "[Microsoft][ODBC Microsoft Access 97 Driver] '(unknown)' isn't a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides."
    I thought that using the ODBC provider wasn't going to work out on a machine without Access installed. I don't know why I thought that?!

    Anyway, thanks!

    Jen

  4. #4
    New Member
    Join Date
    Aug 2002
    Location
    Gillam , MB Canada
    Posts
    9

    Answer for those using data Environment

    Hi, For those using the data environment and having this problem like me. (VB6)

    Open up the properties for the connection.

    Select the ALL tab and look for where it says
    "Jet OLEDBataBase Password " .

    then click the button that says edit the value.

    Then enter the proper password.

    Then select the Connection Tab and select the proper UserID (Admin) and I left the password blank here.

    Then test the connection and all is well.

    I guess there is different levels of passwords here. Hope this helps someone as I tried finding the dataenvironment answer in the forums but came up short. 1 dead link and another the firewall won't let me see. Thanks for the forums I have found many help ful tips.
    Earl

  5. #5
    Hyperactive Member D12Bit's Avatar
    Join Date
    Oct 2000
    Location
    Guatemala
    Posts
    373
    I post the answer to opening a Pasworded database...

    here: http://www.vbforums.com/showthread.p...21#post1259721
    "Who Dares Wins" - "Quien se Arriesga Gana"
    Mail me at:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width