Connection String for an Access Database with Password Protection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you create the Connection String to connect to an mdb database that is
protected with a password?
 
A trick I usually use to generate connection strings is to create a *.udl
file, double click on it, and set various properties in a gui-ish mode. Then
test the connection. Close all dialogs, and open the UDL file in notepad ..
BINGO .. there's your connection string.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 
U¿ytkownik "Sahil Malik said:
A trick I usually use to generate connection strings is to create a *.udl
file, double click on it, and set various properties in a gui-ish mode.
Then test the connection. Close all dialogs, and open the UDL file in
notepad .. BINGO .. there's your connection string.

First time it's hard to find appriopriate property.
If there is password on whole database (simple to crack), connection string
will look:
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Database Password=alice;Data
Source=d:\db1.mdb"

If database is secured on user level connection string will look:
Provider=Microsoft.Jet.OLEDB.4.0;Password=alice;User ID=Gilbert;Data
Source=d:\db1.mdb;Jet OLEDB:System database=d:\Syst.mdw

Regards,
Grzegorz
 
hi
try this
Imports System.Data.OleDb
....
Dim oOleDbConnection As OleDbConnection
Dim sConnString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\myPath\myJet.mdb;" & _
"User ID=Admin;" & _
"Password="
oOleDbConnection = New OleDb.OleDbConnection(sConnString)
oOleDbConnection.Open()


regards
Ansil
 
I'll have to give that a look-see. Thanks

Sahil Malik said:
A trick I usually use to generate connection strings is to create a *.udl
file, double click on it, and set various properties in a gui-ish mode. Then
test the connection. Close all dialogs, and open the UDL file in notepad ..
BINGO .. there's your connection string.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 
Yeah, I know that it will be easy to crack. I just need to keep the standard
end-user from accessing the data base over the network. Most have no
permissions to the database and it isn't shared but some of the more
knowledgeable ones know how to use the administrator password. This will be
enough to keep the hounds at bay though.

Thanks very much
 
Thank you, thank you, thank you all.

I didn't expect to get this many replies in so short of a time.

I am envious of the MCAD. I hope to find the time to go through the program
before I am forced to retire.
 
I believe you need to prefix "Database Password" with "Jet OLEDB:"

ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB:Database Password=alice;" & _
"Data Source=d:\db1.mdb"


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top