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

x
?
Solved

MS Access 2010 connection string problem

Posted on 2010-08-28
7
Medium Priority
?
4,898 Views
Last Modified: 2013-11-28
Hi
I am trying to connect to a secured access 2010 database from C++ code using ADODB
Windows 7, C++ compiled using VS2010

Using the following connection string:
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Data\Dev\Candy\data\Candy.mdb;Persist Security Info=True;Jet OLEDB:System database=C:\Data\Dev\Candy\Data\Security.mdw;"

C++ code:
hr = conn->Open( connection_string, L"Terry", L"pwd", -1);

It fails returning
hr = 0x800A0C94
The error message  I get is:
Connection string = Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Data\Dev\Candy\data\Candy.mdb;Persist Security Info=True;Jet OLEDB:System database=C:\Data\Dev\Candy\Data\Security.mdw;
Details: Error: Unknown error 0x800A0C94
Description: Supplied provider is different from the one already in use.

Which is strange since this is the first connection the code does...
I could connect previous to making the database secured using the mdw file.
the following short cut to launch the secured database works: shortcut :
C:\Data\Dev\Candy\Data\candy.mdb /WRKGRP "C:\Data\Dev\Candy\Data\Security.mdw"


Help!
0
Comment
Question by:10Pints
  • 4
  • 3
7 Comments
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 2000 total points
ID: 33549060
Try the connection string syntax provided at this link:
         http://www.connectionstrings.com/access-2007

For one thing, note that security is not persisted in the example syntax.
0
 

Author Comment

by:10Pints
ID: 33549247
Thanks! Got it working now: I had looked at this and a load of others. Something was wrong when I changed the connection string code (adding a separate db password string)
Tried accessing a data base password protected DB got  the error
Tried setting an mdw file and doing the full DB protection thing ... Same error
Tried backing out all changes back to an unsecured DB ... still got the error ... oops!
Went back to old code and did a diff using Beyond compare could see no real difference maybe a lowercase p on the "Provider=" clause

Then suddenly it worked - not really sure what was wrong now as the new code did  a lot of extra things and time I had butchered it to try get to at least connect in the simplest fashion got confused... lost all will to live really...

Might leave the connection to a fully secured database - so long as I have a password protected DB that is good

Thanks for help - is there any real gain in using an MDW secured database against using just a password protected DB?
0
 
LVL 38

Assisted Solution

by:puppydogbuddy
puppydogbuddy earned 2000 total points
ID: 33549405
a secured mdw is application( Access) level password security, which is an additional layer of security below a windows authentication.  Windows authentication would be sufficient if all of your users are allowed access to the application (MS Acess). If you have several applications and need to restrict which users have access to each application, than you need mdw security.    
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:10Pints
ID: 33550714
Hi and thanks for comment. No it is more what to do with user names and passwords really - we have an access control model: a user has a set of roles. Each role has a set of actions. So only rolled user can perform certain actions - presumably after the requisite authorisation and training. So there currently is a visible  table of  users and their passwords. The gui restricts access to this, but anyone gaining access to the mdb file will be able to see them. a bit primitive really so now wew nearing the end of development I was looking at the ways Access support security. I guess the database password is enough? the MDW approach with its 'hidden' useres and passwords might be better?
0
 
LVL 38

Assisted Solution

by:puppydogbuddy
puppydogbuddy earned 2000 total points
ID: 33563598
The mdw approach is a key component of user level security for ms access, and is certainly more secure than a single DB password in a multi-user environment. See the link for an excellent overview of user level security for ms access.

     http://www.databasedev.co.uk/security_overview.html
0
 

Author Comment

by:10Pints
ID: 33567271
Thanks I will peruse that now I have the DB password connection working: I reckon its what we should have probably - many thanks for your valued help pls accept the points
0
 

Author Closing Comment

by:10Pints
ID: 33567289
Sorted!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

971 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