-
January 24th, 2002, 10:52 AM
#1
Password Protected Access97 Database and ADO
Given an Access97 database, Test.MDB, protected with the password Yesca, how would i go about opening it using ADO. I've tried:
Dim db as new adodb.Connection
db.Open "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=C:\My Documents\Test.mdb", , "Yesca"
and i get an error message:
Run-time error '-2147467259 (80004005)':
Can't start your application. The workgroup information file is missing or opened exlcusively by another user.
Now, the database is not opened by any other user or application. So why would i need workgroup information? If i open the database in Acess, i get no mention of this, just a propmt for the password. Any help would be greatly appreciated.
-
January 24th, 2002, 11:54 AM
#2
Re: Password Protected Access97 Database and ADO
Code:
'connection to secure database
Dim Cnn As ADODB.Connection
'In the place where you want to establish your connection, such
'as the Initialize event of a class module, enter the following:
Dim strConnect As String
Set Cnn = New ADODB.Connection
'Substitute your own User IDs, Password, Data Source, and System
'database in the connection string below
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Password=MyPassword;User ID=Administrator;" & _
"Data Source=C:\AccessDBs\DB1.mdb;" & _
"Persist Security Info=True;" & _
"Jet OLEDB:System database=C:\AccessDBs\system.mdw"
'if you don't need you can eliminate the last line in connection string
With Cnn
.CursorLocation = adUseClient
.Open strConnect
End With
Iouri Boutchkine
iouri@hotsheet.com
[Cimperiali colorized and indented for better reading]
Last edited by Cimperiali; December 7th, 2002 at 05:36 AM.
-
December 17th, 2002, 08:58 AM
#3
I took the code and couldn't get it to work. What am I missing? Thanks.
-
December 17th, 2002, 09:11 AM
#4
Try "User ID=Admin;Password=Yesca;"
-
December 17th, 2002, 09:25 AM
#5
Perhaps a review of Access based authorization (users/passwords/rights) is in order...
User names and passwords are NOT directly stored in the MDB file. The exact technique has varied with different releases of access, but the general concepts is a "workgroup file". This file contains the username,password and a UNIQUE IDENTIFIER. The MDB itself uses the UNIQUE IDENTIFIER to assign the various rights.
Therefore one can not access a protected MDB file until one has "joined" the correct workgroup.
If the MDB file was created elsewhere and the assoicated file was not also distributed, then the data is effectively locked beyon all access [ok, there are some well known security breaks for most versions].
Hope this helps.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 17th, 2002, 09:39 AM
#6
On a related topic ... Is there a way to get access to the workgroup info for a particular database? I would like to use the form/table permissions for editing purposes (i.e. what level of editability does a user have). Any ideas on that front?
Thanks!
- Mike
-
December 17th, 2002, 01:24 PM
#7
Sorry for the double post. I found what I did wrong.
-
December 19th, 2002, 03:56 AM
#8
Before trying this u should have VB SP 4 installed.
Dim Cnn As ADODB.Connection
Dim strConnect As String
Set Cnn = New ADODB.Connection
'database in the connection string below
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Jet OLEDB: Database Password=YourPassword; " & _
"Data Source=C:\AccessDBs\DB1.mdb;" & _
"Persist Security Info=True"
With Cnn
.CursorLocation = adUseServer
.Open strConnect
End With
Last edited by Cimperiali; February 2nd, 2004 at 03:22 AM.
-
January 30th, 2004, 05:41 PM
#9
when I try the code just above I get the fallowing error
could not find installable ISAM.
How do I fix this issue?
Thanks
-
February 2nd, 2004, 03:23 AM
#10
Jet to be installed
You have to install jet drivers, which are not included in latest Mdac_typ.exe.
Make a search at microsoft.com for it herearound:
http://www.microsoft.com/downloads/r...DisplayLang=en
Last edited by Cimperiali; February 2nd, 2004 at 03:25 AM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
February 2nd, 2004, 10:06 AM
#11
ADO is particularly retarded with this respect. I encountered both the errors you post here, neither of which was grounded in tha actual problem.. The installable ISAM was a lie; the connection string was wrong. Also, the "opened by another user" was again, a lie.. the connection string was wrong.
Eventually, i figured out this connection string:
Code:
Private Const DB_PROVIDER = "Microsoft.Jet.OLEDB.4.0;"
...
strConnect = "Provider=" & DB_PROVIDER & _
"Data Source=" & DB_PATH & _
"Jet OLEDB:Database Password=" & DB_PASSWORD
you see, there is a curious set of parameters to connect to the password protected database, the provider specifies the driver to use, the data source specifies the database file on disk. the database password, however, is NOT the same as the passsword entity of a basic ado connection, and basic password is NOT used to connect to an access97 passworded database.
Instead, the driver uses the "database password" specifier.. Now, it is written in msdn that any connection time parameters passed to ADO that are not understood, are passed to the driver. That's another lie.. only when you put "Jet OLEDB:" before database password, does it connect properly (forcing pass from ado to the driver itself)
the conenction string elements must be separated with ;, so your db_path must end in ; and so must the password. the full strConnect will look something like this:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\myDB.mdb;Jet OLEDB:Database Password=myPassword;"
note; this works for me.. your ADO may be retarded again, and not allow it.. i hope it does though
Last edited by cjard; February 2nd, 2004 at 10:08 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|