Access2007 connection string building in code

A

Andrea Raimondi

Hello.

I am a Delphi programmer writing a metaclass for connection strings
generation.
I have been writing pretty much all kinds of strings I will need,
except one, Access2007.
This is due to the fact that my reference
site(www.connectionstrings.com) for that database
does not list all options(i.e. there's no username syntax provided,
just a database password).

What I am wondering is: what is the Access2007 equivalent connection
string for this
access one?

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User
Id=admin;Password=;

The only one I could find as connection string is this:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder
\myAccess2007file.accdb;Persist Security Info=False;

Looking into this group by using google didn't shed any light.

Any clues/hints/suggestions/pointers?

Thank you for your time,

Andrew
 
B

Brendan Reynolds

Andrea Raimondi said:
Hello.

I am a Delphi programmer writing a metaclass for connection strings
generation.
I have been writing pretty much all kinds of strings I will need,
except one, Access2007.
This is due to the fact that my reference
site(www.connectionstrings.com) for that database
does not list all options(i.e. there's no username syntax provided,
just a database password).

What I am wondering is: what is the Access2007 equivalent connection
string for this
access one?

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User
Id=admin;Password=;

The only one I could find as connection string is this:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder
\myAccess2007file.accdb;Persist Security Info=False;

Looking into this group by using google didn't shed any light.

Any clues/hints/suggestions/pointers?

Thank you for your time,

Andrew


Your first example modified to use the ACE.OLEDB.12.0 provider works for me
....

Public Sub TestConString()

Dim cnn As ADODB.Connection
Dim strCnn As String

strCnn = "Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=\\aaron\shareddocs\test.mdb;User Id=admin;Password=;"
Set cnn = New ADODB.Connection
cnn.ConnectionString = strCnn
cnn.Open
Debug.Print (cnn.State = adStateOpen)
cnn.Close

End Sub

Keep in mind that user-level security is not supported when using the new
Access 2007 format, only when using the older Access 2003 or Access
2002/2000 formats, so the usefulness of this example is somewhat limited.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top