Solved

MS Access 2010 connection string problem

Posted on 2010-08-28
7
4,865 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 500 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 500 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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 500 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

809 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