Home Database Mysql Tutorial Access数据库在线压缩的实现

Access数据库在线压缩的实现

Jun 07, 2016 pm 04:23 PM
access compression online accomplish database

Access数据库在线压缩的实现: 如果在 Access 数据库中删除数据或对象,或者在 Access 项目中删除对象,Access 数据库或 Access 项目可能会产生碎片并会降低磁盘空间的使用效率。压缩 Access 数据库或Access项目实际上是复制该文件,并重新组织文件在磁盘上

 Access数据库在线压缩的实现:

如果在 Access 数据库中删除数据或对象,或者在 Access 项目中删除对象,Access 数据库或 Access 项目可能会产生碎片并会降低磁盘空间的使用效率。压缩 Access 数据库或Access项目实际上是复制该文件,并重新组织文件在磁盘上的存储方式。压缩同时优化了 Access 数据库和 Access 项目的性能。 
所以我们在对日益增大的数据库导致的ASP程序慢得无法忍受的时候,就想到了要压缩他。但常规的做法把他下载到本地然后用MSaccess来完成压缩操作,然后再上传!后来我想是否可以在线实现对ACCESS数据库的压缩呢?为此我查了一些资料,但还是不得要领。
我在本机测试获得成功,又上网对自己的动网论坛实施了压缩操作结果也完全正常,数据库从原来的3.7M压缩到了2.1M从而证实是可行的。需要注意的是:本程序其实是通过FSO权限和JET引擎连接,因此在使用之前请确认你的服务器支持FSO(filesystemobject)权限并安装的ACCESS最新驱动!从安全出发,请在压缩之前备份原始数据库!已经测试通过的运行环境: 
WIN98SE+PWS、WIN2000+IIS5.0 
下面是我整理后的源代码,复制另存为compact.asp并上传到数据库所在目录即可正常使用。
 

 
ACCESS数据库压缩程序 
 
 
 
通用ACCESS数据库在线压缩程序
 
 

 
本程序其实是通过FSO权限和JET引擎连接,因此在使用之前请确认你的服务器支持FSO(filesystemobject)权限并安装的ACCESS最新驱动!从安全出发,请在压缩之前备份原始数据库!

 
运行环境:在WIN98SE+PWS、WIN2000+IIS5.0
 
Const JET_3X = 4 
Function CompactDB(dbPath, boolIs97) 
Dim fso, Engine, strDBPath 
strDBPath = left(dbPath,instrrev(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 = "你的数据库, " & dbpath & ", 已经被压缩" & vbCrLf 
Else 
CompactDB = "你输入的数据库路径或名称未找到,请重试" & vbCrLf 
End If 

End Function 
%> 
 
 
 
压缩选项,请仔细填写!
 

 
输入数据库全称: 
 
(包括扩展名,如MDB、ASA、ASP等)
 

 
 
检查是否为ACCESS97数据库
 
(默认为ACCESS2000的数据库)
 

 
 
 
 
 
Dim dbpath,boolIs97 
dbpath = request("dbpath") 
boolIs97 = request("boolIs97") 

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

 
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

How to use Debian Apache logs to improve website performance How to use Debian Apache logs to improve website performance Apr 12, 2025 pm 11:36 PM

This article will explain how to improve website performance by analyzing Apache logs under the Debian system. 1. Log Analysis Basics Apache log records the detailed information of all HTTP requests, including IP address, timestamp, request URL, HTTP method and response code. In Debian systems, these logs are usually located in the /var/log/apache2/access.log and /var/log/apache2/error.log directories. Understanding the log structure is the first step in effective analysis. 2. Log analysis tool You can use a variety of tools to analyze Apache logs: Command line tools: grep, awk, sed and other command line tools.

Solution to MySQL encounters 'Access denied for user' problem Solution to MySQL encounters 'Access denied for user' problem Apr 11, 2025 pm 05:36 PM

How to solve the MySQL "Access denied for user" error: 1. Check the user's permission to connect to the database; 2. Reset the password; 3. Allow remote connections; 4. Refresh permissions; 5. Check the database server configuration (bind-address, skip-grant-tables); 6. Check the firewall rules; 7. Restart the MySQL service. Tip: Make changes after backing up the database.

How to configure Debian Apache log format How to configure Debian Apache log format Apr 12, 2025 pm 11:30 PM

This article describes how to customize Apache's log format on Debian systems. The following steps will guide you through the configuration process: Step 1: Access the Apache configuration file The main Apache configuration file of the Debian system is usually located in /etc/apache2/apache2.conf or /etc/apache2/httpd.conf. Open the configuration file with root permissions using the following command: sudonano/etc/apache2/apache2.conf or sudonano/etc/apache2/httpd.conf Step 2: Define custom log formats to find or

Summary of phpmyadmin vulnerabilities Summary of phpmyadmin vulnerabilities Apr 10, 2025 pm 10:24 PM

The key to PHPMyAdmin security defense strategy is: 1. Use the latest version of PHPMyAdmin and regularly update PHP and MySQL; 2. Strictly control access rights, use .htaccess or web server access control; 3. Enable strong password and two-factor authentication; 4. Back up the database regularly; 5. Carefully check the configuration files to avoid exposing sensitive information; 6. Use Web Application Firewall (WAF); 7. Carry out security audits. These measures can effectively reduce the security risks caused by PHPMyAdmin due to improper configuration, over-old version or environmental security risks, and ensure the security of the database.

What is apache server? What is apache server for? What is apache server? What is apache server for? Apr 13, 2025 am 11:57 AM

Apache server is a powerful web server software that acts as a bridge between browsers and website servers. 1. It handles HTTP requests and returns web page content based on requests; 2. Modular design allows extended functions, such as support for SSL encryption and dynamic web pages; 3. Configuration files (such as virtual host configurations) need to be carefully set to avoid security vulnerabilities, and optimize performance parameters, such as thread count and timeout time, in order to build high-performance and secure web applications.

See all articles