Solved

MS Access 2010 connection string problem

Posted on 2010-08-28
7
4,884 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

636 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