Describes how to implement online compression for Access databases.

Source: Internet
Author: User
If you delete data or objects in the access database or delete objects in the Access Project, the Access database or Access project may produce fragments and reduce the disk space usage efficiency. Compressing the Access database or Access project is actually copying the file and reorganizing the storage mode of the file on the disk. Simultaneous compression Optimization

If you delete data or objects in the access database or delete objects in the Access Project, the Access database or Access project may produce fragments and reduce the disk space usage efficiency. Compressing the Access database or Access project is actually copying the file and reorganizing the storage mode of the file on the disk. Simultaneous compression Optimization

IfDatabaseTo delete data or objects, or to delete objects in the Access Project, AccessDatabaseOr the Access project may cause fragmentation and reduce the efficiency of disk space usage.CompressionAccessDatabaseOr the Access project is actually copying the file and reorganizing the storage of the file on the disk.CompressionThe AccessDatabaseAnd Access project performance.

So we areDatabaseWhen the asp program is too slow to bear, I thoughtCompressionHe. However, the general practice is to download it to the local device and then use MSaccess to complete the process.CompressionOperation, and then upload!

Note that this program is actually connected to the JET engine through the fso permission. Therefore, before using it, please confirm that your server supports the FSO (filesystemobject) Permission and install the latest ACCESS driver! For security reasons, goCompressionOriginal backupDatabase! Environment that has passed the test:

WIN98SE + PWS, WIN2000 + IIS5.0

The following is the compiled source code. Copy and save it as compact. asp and upload itDatabaseThe directory can be used normally.




ACCESS <strong> database </strong> <strong> compression </strong> Program




General ACCESSDatabaseOnlineCompressionProgram




This program is actually connected to the JET engine through the FSO permission,
Therefore, make sure that your server supports FSO before use.
(Filesystemobject) Permission and install the latest ACCESS driver!
For security reasons, goCompressionOriginal backupDatabase!



Running Environment: In WIN98SE + PWS, WIN2000 + IIS5.0

<%
Const JET_3X = 4
Function CompactDB (dbPath, boolIs97)
Dim fso, Engine, strDBPath
StrDBPath = left (dbPath, limit Rev (DBPath ,"\"))
Set fso = CreateObject ("Scripting. FileSystemObject ")

If fso. FileExists (dbPath) Then
Set Engine = CreateObject ("JRO. JetEngine ")

If boolIs97 = "True" Then
Engine. CompactDatabase "PRovider = Microsoft. Jet. OLEDB.4.0; Data Source =" & dbpath ,_
"Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & strDBPath & "temp. mdb ;"_
& "Jet OLEDB: Engine Type =" & JET_3X
Else
Engine. CompactDatabase "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & dbpath ,_
"Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & strDBPath & "temp. mdb"
End If
Fso. CopyFile strDBPath & "temp. mdb", dbpath
Fso. DeleteFile (strDBPath & "temp. mdb ")
Set fso = nothing
Set Engine = nothing
CompactDB = "YourDatabase, "& Dbpath &", has beenCompression"& VbCrLf
Else
CompactDB = "your inputDatabasePath or name not found. Please try again "& vbCrLf
End If

End Function
%>





<%
Dim dbpath, boolIs97
Dbpath = request ("dbpath ")
BoolIs97 = request ("boolIs97 ")

If dbpath <> "" Then
Dbpath = server. mappath (dbpath)
Response. write (CompactDB (dbpath, boolIs97 ))
End If
%>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.