0

I have an Ado connection in my form and use Access 2010 ( accdb database ) 64 bit system

I have a password set in access 2010 for my DB

I am using Ado connection string to connect Delphi 7 and the 2010 Access database.

when I try to set connection an error occurs that says "test connection failed because of an error in initializing provider. cannot open database." It may not be a database that your application recognizes, or the file may be corrupt.

However, when I create another database without a password, the ado connection string works after testing connection.

I have also installed AccessDatabaseEngine but it still does not work. In addition, The Ado is working with the password on my other computer with 32bit system but fails on 64bit system. What is the solution and why is this happening?

Ken White
  • 123,280
  • 14
  • 225
  • 444
allxn
  • 77
  • 2
  • 11
  • You should **always** include the common tags like `delphi` or `ms-access`. They are useful for syntax highlighter and more attention on your question. Please edit your question – Sir Rufo Jan 07 '15 at 19:57
  • I found out that the test connection error occurred because I was using ms-access 2007 database which does not support some features from 2010 database. I simply reverted Ms-access 2010 database back to "Access 2007 format" and solved the problem. In addition, running an application created with delphi 7 and Ms-access 2010 does not work with Ms-access 2007, but errors will result. – allxn Jan 08 '15 at 17:47

1 Answers1

0

It seems like the ADO ConnectionString Builder does not create a Connection String that works with password protected mdb's... at least I could not get it working :-)

When using the ADO ConnectionString Builder I got the error, "Cannot start your application. The workgroup information file is missing or opened exclusively by another user." This was the malfunctioning connection string:

Provider=Microsoft.Jet.OLEDB.4.0;Password=MyPwd;Data Source=C:\...\MyDB.mdb;Persist Security Info=True

I solved it by writing code that assigned the connection string advised in this SO solution. Here's my code:

ADOConnection1.LoginPrompt := false;
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\...\MyDB.mdb;Jet OLEDB:Database Password=MyPwd;';
ADOConnection1.Connected := true;

Note: I used Delphi XE3, 32bit app on Win 7 64bit.

Community
  • 1
  • 1
Lars
  • 1,428
  • 1
  • 13
  • 22