The Access database is often used in some small system programs. To increase the security of the information in the database, the simplest way is to add a password to the access file (of course, you can also encrypt the data in the database and store it in the file to protect the data, but this method requires you to consider encryption and decryption in the program.) What about accessing a password file through a database connection string? Below are some solutions I have found on the network. Collect it for future use.
There are three types of access database encryption:
The following uses Access XP as an example.
1. Tools-> Security-> encryption/decryption of the database. No changes are required when the database is opened.
2. Tools-> Security-> set the Database Password to 1.
"Provider = Microsoft. Jet. oledb.4.0; Data Source = c: \ 1.mdb; user id = admin; Password =; Jet oledb: Database Password = 1" |
You can also use
"Provider = Microsoft. Jet. oledb.4.0; Data Source = c: \ 1.mdb; user id = 'admin'; Password =; Jet oledb: Database Password = '1 '" |
3. Tools-> Security-> User Group and permissions.... the user name is admin and the password is RR. the user group file is c: \ system. MDW.
"Provider = Microsoft. jet. oledb.4.0; Data Source = c: \ 1.mdb; user id = admin; Password = RR; Jet oledb: Database Password = 1; Jet oledb: System database = c: \ system. MDW" |
You can also use
"Provider = Microsoft. jet. oledb.4.0; Data Source = c: \ 1.mdb; user id = 'admin'; Password = 'rr '; Jet oledb: Database Password = '1'; Jet oledb: System database = C: \ system. MDW" |
If you share the access to the database on the LAN, you only need to change the absolute path to "\ computer name \ shared directory name \ file name. mdb", such
"Provider = Microsoft. jet. oledb.4.0; Data Source =\\ access911 \ floder1 \ 1.mdb; user id = 'admin'; Password = 'rr '; Jet oledb: Database Password = '1'; Jet oledb: system database =\\ access911 \ floder1 \ system. MDW" |
It is also possible to define the mode attribute in the connection string to achieve exclusive/public access, for example:
Jetoledb: globalpartialbulkops = 2; jetoledb: registrypath =; jetoledb: databaselockingmode = 1; jetoledb: databasepassword =; datasource = D: \ dB. MDB; Password =; jetoledb: enginetype = 5; jetoledb: globalbulktransactions = 1; provider = Microsoft. jet. oledb.4.0; jetoledb: systemdatabase =; jetoledb: SFP = false; extendedproperties =; mode = sharedenynone; jetoledb: Rule =; jetoledb: createsystemdatabase = false; jetoledb: Don 'rule = false; jetoledb: compactwithoutreplicarepair = false; userid = admin; jetoledb: encryptdatabase = false |
Note: Access 2007 has greatly changed the data format, so the data provider is no longer Jet DB 4.0, and Microsoft. Ace. oledb.12.0 is the data provider of *. accdb.
Provider = Microsoft. ace. oledb.12.0; user id = admin; Data Source = c: \ Documents and Settings \ chenge \ My Documents \ database 1. accdb; mode = share deny read | share deny write; extended properties = ""; Jet oledb: System database = C: \ Documents and Settings \ chenge \ Application Data \ Microsoft \ access \ system. MDW; Jet oledb: Registry Path = SOFTWARE \ Microsoft \ Office \ 12.0 \ access connectivity engine; Jet oledb: Database Password = ""; Jet oledb: Engine type = 6; jet oledb: Database locking mode = 0; Jet oledb: Global partial bulk Ops = 2; Jet oledb: Global bulk transactions = 1; Jet oledb: New Database Password = ""; jet oledb: Create System database = false; Jet oledb: encrypt database = false; Jet oledb: Don't copy locale on compact = false; Jet oledb: compact without replica repair = false; jet oledb: SFP = false; Jet oledb: support complex data = true