Connect to AccessDB (.mdb) when user is impersonated via OleDB using VB.NET application


current environment:

  • AccessDatabase (.mdb) file located at secured network share
  • special domain user account has read/write permissions to this network share
  • VB.NET application running in users context must connect to AccessDatabase

Running application with user account having direct access to network share connection will be established. When I try to impersonate user context to get access to network share (check database file is accessible) first application can't establish database connection. Exception "unknown error specified" will be thrown while exexuting command db.Open(). I tried to set up dababase security file (.mdw) to pass special user name won't work also.
ConnectionString: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='\serverName\shareName\myDatabase.mdb';Jet OLEDB:System Database='\serverName\shareName\myDatabase.mdw';User Id='myUser';Password='';"

Trying to connect with disabled pooling will fail also
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source='\serverName\shareName\myDatabase.mdb';Jet OLEDB:System Database='\serverName\shareName\myDatabase.mdw';OLE DB Services=-2;User Id='myUser';Password='';"

Does anyone has a hint how to establish connection when impersonated user context is established?

0 answers