Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Simple one - ODBC connection file - Database security.

Posted on 2004-04-14
4
Medium Priority
?
856 Views
Last Modified: 2012-08-13
This is a simple question and i feel pretty ridiculous to ask! But here it is anyway, coz i feel i have a mind block today.

* I have an Access Database
* I opened it exclusively
* Selected Tools >> Security >> Set database password
* Typed a new password "xyz" and retyped new password "xyz"

Then I edited my connection file to this

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strDataPath = server.MapPath("database.mdb")

strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
               & " Data Source= " & strDataPath & ";"_
               & " Mode=Share Deny None;User Id=admin;PASSWORD=xyz;"

if not IsObject("conn") then
     set conn=Server.CreateObject("ADODB.Connection")
     conn.ConnectionTimeout = 15
     conn.CommandTimeout =  10
     conn.Mode = 3 'adModeReadWrite
     if conn.state = 0 then
          conn.Open strConnectString
     end if
end if
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is the error i got:-

Microsoft JET Database Engine (0x80040E4D)
Cannot start your application. The workgroup information file is missing or opened exclusively by another user.

Should i have created a workgroup? What am i missing?
0
Comment
Question by:sciber_dude
  • 2
4 Comments
 
LVL 12

Assisted Solution

by:dfiala13
dfiala13 earned 800 total points
ID: 10828154
You set a database password, which is stored with the database, not the workgroup file.  The connection string User ID and password are validated via the workgroup file.  So the connection string is trying to pass the password and user ID to the default workgroup file, which has no knowledge of the user ID and password being sent to it.  It is still expecting User ID = "admin" and password = "".

Try this...
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:\somepath\mydb.mdb;" & _
           "Jet OLEDB:Database Password=MyDbPassword", _
           "myUsername", "myPassword"
And check out

http://www.able-consulting.com/ADO_Conn.htm

for all kinds of connection strings


You're other option is to implement workgroup security.
0
 
LVL 11

Author Comment

by:sciber_dude
ID: 10828379
well.. let me rephrase my question.

I want my access database to be password protected.

What do i do and How do i change my code?

A step-by-step account is preferable coz i got a mind-block today. :(

SD
0
 
LVL 7

Accepted Solution

by:
brgivens earned 1200 total points
ID: 10828995
Dim conn

Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=test"  <- password you created goes here
conn.Open Server.MapPath("test.mdb")
0
 
LVL 11

Author Comment

by:sciber_dude
ID: 11071461
@ brgivens -

Sorry for not responding to this question for so long. There were some issues here and I did not have access to these files (Murphy's Law). My permissions will be reinstated on Monday. Will check it and let you know.

:) SD
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question