DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Password Protection for database.

  1. #1
    Jorge Guest

    Password Protection for database.


    Hello all,

    Here is what I am looking for. I have a Microsoft Access Database with several
    tables in it that I would like to password protect or lock. What I want
    to be able to do is have the application un-password protect or unlock it
    and then re-password protect or lock it so that users can not modify the
    data unless it is throught the application I am developing.

    If anyone knows an easy way to impliment this please provide me with an example.

    Thank very much for your assistance.

    Jorge


  2. #2
    Guest

    Re: Password Protection for database.


    "Jorge" <jmaldonado@ussincorp.com> wrote:
    >
    >Hello all,
    >
    >Here is what I am looking for. I have a Microsoft Access Database with

    several
    >tables in it that I would like to password protect or lock. What I want
    >to be able to do is have the application un-password protect or unlock it
    >and then re-password protect or lock it so that users can not modify the
    >data unless it is throught the application I am developing.
    >
    >If anyone knows an easy way to impliment this please provide me with an

    example.
    >
    >Thank very much for your assistance.
    >
    >Jorge
    >'*********************************

    A couple of ways to handle this.

    1. Use the password protection option under tools/security

    2. Under Tools/Startup there option you can select and unselect so the user
    can't get to the backend of the database. Play around there and let me know
    if this helps.

    Jim


  3. #3
    Rick Guest

    Re: Password Protection for database.



    Jorge -

    You can set the password through the Access application and then, in your
    application code, open the database *using* the password. You would not
    need to remove the password.

    However, you can add, remove, change, the password all through the code as
    well.

    *How* you do it depends on if you are using ADO or DAO. I have working examples
    using DAO. If you are interested, let me know and I will post them.

    Best of Luck,

    Rick






  4. #4
    Kevin MacCallum Guest

    Re: Password Protection for database.


    If your are using ADO to open your Access database, here is a function that
    will return a valid connection string you can pass to the ADO Connection,
    Recordset or Command objects.

    *************************************
    Public Function ConnectionString() As String
    'returns the connection string to open the database
    On Error GoTo ErrHandler

    Dim sDBName As String
    Dim sDBPwd As String, sUserPwd As String, sUserId As String, sMdw As String

    'If the database is just password protected you need to put the password
    in the
    '"Jet OLEDBatabase Password" property of the connection string.
    'If you are going to use Access security then you use the "User ID" & "Password"
    'properties of the connection string plus you need to tell it where the
    'MDW (Access security file) is through the "Jet OLEDB:System database" property.

    sDBName = C:\temp\databasename.mdb'full path to Access database
    sDBPwd = vbNullString 'database password here or leave blank if no database
    password

    'next 3 are required if you are using Access security
    'if not using it then all 3 can be left blank
    sUserPwd = vbNullString 'user password here if using Acess security
    sUserId = vbNullString 'user id here if using Access security
    sMdw = vbNullString ' full path to the MDW (Access security file)

    ConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0" & _
    ";Data Source=" & sDBName & _
    ";Mode=ReadWrite|Share Deny None" & _
    ";Persist Security Info=false" & _
    ";Jet OLEDBatabase Password=" & sDBPwd & _
    ";Password=" & sUserPwd & _
    ";User ID=" & sUserId & _
    ";Jet OLEDB:System database=" & sMdw
    End If

    Exit Function

    ErrHandler:
    ConnectionString = vbNullString
    End Function
    *************************************

    Kevin MacCallum

    "Jorge" <jmaldonado@ussincorp.com> wrote:
    >
    >Hello all,
    >
    >Here is what I am looking for. I have a Microsoft Access Database with

    several
    >tables in it that I would like to password protect or lock. What I want
    >to be able to do is have the application un-password protect or unlock it
    >and then re-password protect or lock it so that users can not modify the
    >data unless it is throught the application I am developing.
    >
    >If anyone knows an easy way to impliment this please provide me with an

    example.
    >
    >Thank very much for your assistance.
    >
    >Jorge
    >



  5. #5
    Jorge Guest

    Re: Password Protection for database.


    Rick,

    I am using ADO. I set connection to my tables with the adodc data control
    and set connection to ADODB.Connection object. Just depends on if I am trying
    to run a storedprocedure, update fields in a given table or, display a record
    or entire recordset in a TrueDBGrid7.0(OLEDB) Control.

    Jorge

    "Rick" <rsteinberger@icmarc.org> wrote:
    >
    >
    >Jorge -
    >
    >You can set the password through the Access application and then, in your
    > application code, open the database *using* the password. You would not
    >need to remove the password.
    >
    >However, you can add, remove, change, the password all through the code

    as
    >well.
    >
    >*How* you do it depends on if you are using ADO or DAO. I have working examples
    >using DAO. If you are interested, let me know and I will post them.
    >
    >Best of Luck,
    >
    >Rick
    >
    >
    >
    >
    >



  6. #6
    Jorge Guest

    Re: Password Protection for database.


    Kevin, this all looks great. What method would you recommend. My only interest
    is to insure that the database is not tampered with outside of the application
    by the user or users who will be using the finished product.

    If I can set the password protection up at the time the application is run.
    I would be off to a great start. I know I can store the username and password
    in the user or system registry.

    Once password protection for the database is in place if I can just pass
    a username and password in the connectionstring this would be fantastic.
    I would prefer not to leave anything up to Access. Having total control
    of the applicatino process and database access just make me feel more confortable.
    I am willing to give up the comfort for the best method possible to insure
    no user can trash the database using access. If they delete it, well then
    is $250 an hours techsupport call.

    Jorge

    "Kevin MacCallum" <kdmaccal@gapac_stuff_.com> wrote:
    >
    >If your are using ADO to open your Access database, here is a function that
    >will return a valid connection string you can pass to the ADO Connection,
    >Recordset or Command objects.
    >
    >*************************************
    >Public Function ConnectionString() As String
    >'returns the connection string to open the database
    >On Error GoTo ErrHandler
    >
    >Dim sDBName As String
    >Dim sDBPwd As String, sUserPwd As String, sUserId As String, sMdw As String
    >
    >'If the database is just password protected you need to put the password
    >in the
    >'"Jet OLEDBatabase Password" property of the connection string.
    >'If you are going to use Access security then you use the "User ID" & "Password"
    >'properties of the connection string plus you need to tell it where the
    >'MDW (Access security file) is through the "Jet OLEDB:System database" property.
    >
    > sDBName = C:\temp\databasename.mdb'full path to Access database
    > sDBPwd = vbNullString 'database password here or leave blank if no database
    >password
    >
    > 'next 3 are required if you are using Access security
    > 'if not using it then all 3 can be left blank
    > sUserPwd = vbNullString 'user password here if using Acess security
    > sUserId = vbNullString 'user id here if using Access security
    > sMdw = vbNullString ' full path to the MDW (Access security file)
    >
    > ConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0" & _
    > ";Data Source=" & sDBName & _
    > ";Mode=ReadWrite|Share Deny None" & _
    > ";Persist Security Info=false" & _
    > ";Jet OLEDBatabase Password=" & sDBPwd & _
    > ";Password=" & sUserPwd & _
    > ";User ID=" & sUserId & _
    > ";Jet OLEDB:System database=" & sMdw
    >End If
    >
    >Exit Function
    >
    >ErrHandler:
    >ConnectionString = vbNullString
    >End Function
    >*************************************
    >
    >Kevin MacCallum
    >
    >"Jorge" <jmaldonado@ussincorp.com> wrote:
    >>
    >>Hello all,
    >>
    >>Here is what I am looking for. I have a Microsoft Access Database with

    >several
    >>tables in it that I would like to password protect or lock. What I want
    >>to be able to do is have the application un-password protect or unlock

    it
    >>and then re-password protect or lock it so that users can not modify the
    >>data unless it is throught the application I am developing.
    >>
    >>If anyone knows an easy way to impliment this please provide me with an

    >example.
    >>
    >>Thank very much for your assistance.
    >>
    >>Jorge
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center