Solved

MS Access 2010 connection string problem

Posted on 2010-08-28
7
4,855 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
Comment Utility
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
Comment Utility
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
Comment Utility
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:10Pints
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Sorted!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now