64位系统使用Access 数据库文件的彻底解决方法
最近,有PDF.NET用户问我怎么在64位 系统 下无法访问Access 数据库 的问题,我第一反应是我怎么没有遇到呢?今天一看自己的VS和Office都是32位版本的,所以在VS里面调试访问Access是没有问题的,但是直接 使用 编译好的.NET程序访问Access,就出问题了,报:
最近,有PDF.NET用户问我怎么在64位系统下无法访问Access数据库的问题,我第一反应是我怎么没有遇到呢?今天一看自己的VS和Office都是32位版本的,所以在VS里面调试访问Access是没有问题的,但是直接使用编译好的.NET程序访问Access,就出问题了,报:
未在本地计算机上注册“Microsoft.Jet.Oledb.4.0”提供程序。
于是,又在公司的电脑上(Win7 64位)做了实验,发现跟家里面的Win8.1 64位 问题一样,上网搜索了一下,大部分都建议将.NET程序编译的时候,目标平台设定为 x86 ,我试了下,果然成功。
但是,如果你的.NET程序是别人编译好的,且在64位系统上运行,要访问Access数据库,怎么办呢?
首先想到,看能否通过应用程序配置文件,将.NET程序配置成运行在 32位 系统下,找了很久资料,无果,放弃。
再想想,是不是跟自己的Office是32位有关呢?
关键问题不在于是Access 2010还是Access 2013而已,不必钻牛角尖,何不求其次,安装一个Access 2007/2010的Database Engine不就行了。
解决办法:
① 下载安装Microsoft Access Database Engine 2010 Redistributable(28MB),共有32bit(下载)和64bit(下载)两个版本,具体要安装哪个要看你的Office程序是32bit的还是64bit的,比如:我的PC是64bit的Win8 Pro,但是我Office的程序是32bit的,所以我应当安装AccessDatabaseEngine.exe(32bit);
② 打开你的.NET应用程序配置文件(应用程序名.config,Web应用程序为 Web.config),设置数据库连接字符串的Provide Microsoft.ACE.OLEDB.12.0,例如标准连接字符串为:"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Data.accdb;Persist Security Info=False;"
再次运行程序,OK,数据库连接成功,一切正常。
注意:64位系统下一定要修改提供程序为 Microsoft.ACE.OLEDB.12.0,而此时的文件名,可以是 早期的 mdb文件,也可以是新的 accdb 文件。
如果你虽然是64位系统,但是你的Office 是32位的,所以你只能安装32位的ACE驱动,因此你的.NET应用程序也只能发布成32位的,如果编译成anycpu版本,还是无法访问ACE。
(PS:如果你发布成x86格式的目标平台,并且不想使用accdb格式的Access数据库文件,那么就不必安装上面的32位ACE驱动了,省得折腾:-《)
此问题受影响的 PDF.NET 开发框架相关程序:
1,SimpleAccessWinForm 程序,下载地址 , PDF.Net_V4.6 WinForm 数据表单实例
example, 526K, uploaded Mar 27, 2013 - 809 downloads
运行该程序后,请修改 SimpleAccessWinForm.config 文件的内容,如果是第一次运行,程序会自动创建该文件 并自动创建数据库文件,文件内容比如:
<span></span><span>xml version="1.0" encoding="utf-8"</span><span>?></span> <span><span>configuration</span><span>></span> <span><span>connectionStrings</span><span>></span> <span><span>add </span><span>name</span><span>="AccessConn"</span><span> connectionString</span><span>="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=TEST.mdb"</span><span> providerName</span><span>="Access"</span> <span>/></span> <span></span><span>connectionStrings</span><span>></span> <span></span><span>configuration</span><span>></span></span></span></span>
2,PDF.NET集成开发工具,下载地址: 安装程序
application, 1576K, uploaded May 25, 2011 - 1943 downloads
下载后,请找到运行目录下的 子目录 Config ,然后打开配置文件 DataConnectionCfg.xml ,找到相关的配置节:
<span></span><span>xml version="1.0" encoding="utf-8" </span><span>?></span> <span><span>DataConnections</span><span>></span> <span><span>Group </span><span>Name</span><span>="默认分组"</span><span>></span> <span><span>Connection </span><span>DbType</span><span>="SQLServer"</span><span> Name</span><span>="default"</span><span> ConnectionString</span><span>="Data Source=.;Integrated Security=True"</span> <span>/></span> <span><span>Connection </span><span>DbType</span><span>="SQLServer"</span><span> Name</span><span>=".\SQLEXPRESS"</span><span> ConnectionString</span><span>="Data Source=.\SQLEXPRESS;Integrated Security=True"</span> <span>/></span> <span><span>Connection </span><span>DbType</span><span>="SQLServerCe"</span><span> Name</span><span>="SQLCE"</span><span> ConnectionString</span><span>="Data Source=E:\DAC\LocalDB.sdf;Password=sasa;Persist Security Info=True"</span> <span>/></span> <span></span><span>Group</span><span>></span> <span><span>Group </span><span>Name</span><span>="XX二期"</span><span>></span> <span><span>Connection </span><span>DbType</span><span>="SQLite"</span><span> Name</span><span>="SQLite"</span><span> ConnectionString</span><span>="Data Source=E:\jjzd.db"</span><span> Provider</span><span>="PWMIS.DataProvider.Data.SQLite,DataAccess"</span><span>/></span> <span><span>Connection </span><span>DbType</span><span>="SQLServer"</span><span> Name</span><span>="192.168.50.1"</span><span> ConnectionString</span><span>="server=192.168.50.5;uid=sa;pwd=sasa"</span><span> Provider</span><span>=""</span><span>/></span> <span></span><span>Group</span><span>></span> <span><span>Group </span><span>Name</span><span>="分组2"</span><span>></span> <span><span>Connection </span><span>DbType</span><span>="Access"</span><span> Name</span><span>="default"</span><span> ConnectionString</span><span>="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=TEST.mdb"</span><span> Provider</span><span>="Access"</span><span>/></span> <span><span>Connection </span><span>DbType</span><span>="SQLServer"</span><span> Name</span><span>="50.25"</span><span> ConnectionString</span><span>="server=192.168.50.25;uid=sa;pwd=sasa"</span><span> Provider</span><span>=""</span><span>/></span> <span></span><span>Group</span><span>></span> <span></span><span>DataConnections</span><span>></span></span></span></span></span></span></span></span></span></span></span></span>
经过这样的配置以后,就可以直接打开集成开发工具了,如下图:
总结:
64位系统下.NET访问Access 数据库,最彻底的方法是安装64位的Access数据访问驱动安装程序 并使用新的Access提供程序 Microsoft.ACE.OLEDB.12.0

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

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.

Nginx performance monitoring and troubleshooting are mainly carried out through the following steps: 1. Use nginx-V to view version information, and enable the stub_status module to monitor the number of active connections, requests and cache hit rate; 2. Use top command to monitor system resource occupation, iostat and vmstat monitor disk I/O and memory usage respectively; 3. Use tcpdump to capture packets to analyze network traffic and troubleshoot network connection problems; 4. Properly configure the number of worker processes to avoid insufficient concurrent processing capabilities or excessive process context switching overhead; 5. Correctly configure Nginx cache to avoid improper cache size settings; 6. By analyzing Nginx logs, such as using awk and grep commands or ELK

The Nginx current limit problem can be solved by: use ngx_http_limit_req_module to limit the number of requests; use ngx_http_limit_conn_module to limit the number of connections; use third-party modules (ngx_http_limit_connections_module, ngx_http_limit_rate_module, ngx_http_access_module) to implement more current limit policies; use cloud services (Cloudflare, Google Cloud Rate Limiting, AWS WAF) to DD
