none
Persist Security Info=False does not work on Access 2007 DB with Password RRS feed

  • Question

  • I am opening an Access 2007 DB with a password. The DB opens fine, but the connection string still displays the password even after the DB is opened. I have tried this with SQL Express, and it works correctly, removing the password from the connection string after the DB is opened.

    Here is my connection string: 

    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\__TestProjects\\Test777\\TestApp2\\bin\\Debug\\Database1.accdb;Persist Security Info=False;Jet OLEDB:Database Password=password"

     Here is the code top open the DB:

                                                                    OleDbConnection conn = new OleDbConnection(ConnectionString);

                                                                    conn.Open();

                                                                    string test = conn.ConnectionString;

                                                                    conn.Close();

     

    After the open statement, the ConnectionString still contains the password. This does not happen in SQL Express.

     

    Thanks in advance,

     

    John 

     

    • Moved by Tom Li - MSFT Wednesday, December 8, 2010 7:55 AM (From:SQL Server Compact)
    • Moved by Bessie Zhao Thursday, December 9, 2010 6:50 AM for more support (From:Access for Developers)
    Tuesday, December 7, 2010 5:41 PM

All replies

  • Please ask in the Microsoft Acces forum - this forum is for SQL Server Compact.
    Visit my SQL Compact blog - http://erikej.blogspot.com - Please mark as answer, if this was it.
    Tuesday, December 7, 2010 6:45 PM
  • Hello John,

    Thanks for posting. Actually, this question is more an ADO.NET issue. I will move this thread from Access forum to ADO.NET managed providers forum for better support. Have a nice day.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, December 9, 2010 6:49 AM
  • I know this won't help in your current situation, but the explanation is that is that when Persist Security Info=false (default) then
    the .Net code looks for, and strips out, values for the keywords "Password" and "Pwd".

    When using Access database password, the keywords in the connectionstring is "Jet OLEDB:Database Password=password" and there is no check for that.
    When using SQL Express (or other SQL Server editions) the password key is "Password" or "Pwd", so it is stripped.

    I do not know away around this unless one would write their own logic to remove "Jet OLEDB:Database Password=password" from the connectionstring.


    This posting is provided "AS IS" with no warranties.
    • Proposed as answer by VMazurModerator Friday, December 10, 2010 11:59 AM
    • Unproposed as answer by John_11 Sunday, December 12, 2010 7:59 PM
    Thursday, December 9, 2010 11:05 AM
  • Well, the problem with that is that you cannot modify the connection string once you are connected. I also tried this with an older Access2000 DB using the keyword Pwd, and I believe it had the same issue.

    I would use the SQL Express, but it is such a big download for my customers with limited bandwidth, and my minimal use of the DB does not require it.

    Sunday, December 12, 2010 7:45 PM