x64应用程序访问mdb数据库 [英] x64 Application Accessing mdb database

查看:95
本文介绍了x64应用程序访问mdb数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要在x64平台下构建的应用程序.我需要访问一个 .mdb 文件.访问是指插入,删除或更新数据库.我在使用Jet OLE db和ODBC驱动程序时遇到问题.使用OLE db,它显示"Jet Oledb未注册".使用ODBC平台时,驱动程序和应用程序之间不匹配.我可以在X86平台上执行这些操作.但是在我的应用程序中,我被要求在x64平台下构建我的项目.谁能为我提供任何解决方案. N.B.我不应该使用任何第3个应用程序与x64应用程序和数据库进行通信.

I have an application that needs to be built under x64 platform. I need to access an .mdb file. By accessing I mean, inserting, deleting or updating the db. I having trouble using Jet OLE db and ODBC drivers. With OLE db it shows "Jet Oledb not registered". With ODBC Platform mismatch between driver and application. I can do these operations in X86 platform. But in my application I was asked to build my project under x64 platform. Can anybody provide me with any solution. N.B. I should not use any 3rd application to communicate with x64 app and database.

感谢您的任何提前答复.

Thanks to any response in advance.

推荐答案

您需要使用Microsoft提供的最新驱动程序ACE
在这里您可以找到下载位

You need to use the newest driver from Microsoft called ACE
Here you can find the download bits

请注意为您的目标计算机下载正确的设置(x64或x86) 另外,连接字符串应使用这些驱动程序,因此您可能需要这样的连接字符串

Pay attention to download the correct set (x64 or x86) for your intended target machine Also the connection string should make use of these drivers, so you probably need a connection string like this

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=yourPathToTheMDBFile.mdb;
Persist Security Info=False;

作为替代方案,您可以构建您的x86平台应用程序,并且,如果您不与64位代码进行任何直接交互,则它将在64位操作系统中正常工作.此解决方案是可取的,因为您可以使用旧的JET.OleDb.4.0

As an alternative you could build your application for x86 platform and, if you don't have any direct interaction with 64bit code, it will works as is in the 64bit operating system. This solution is preferable because you could use the old JET.OleDb.4.0

让我简要说明一下64/32位操作系统,用于构建应用程序的平台和32/64位驱动程序的问题:

Let me give a brief explanation of the problem with 64/32bit operating system, Platform used to build applications and 32/64bit drivers:

  • 您为AnyCPU平台构建应用程序-您的代码运行正常 在32/64位系统中,JIT编译器发出的代码将具有 来宾操作系统的相同位数.但是,您不能通过以下方式使用32位驱动程序 64位应用程序,反之亦然. JET.OleDB.4.0仅32位.如果游戏结束 您可以为AnyCPU编译并在64位上运行.您需要一个64位驱动程序.
  • 您为x86平台构建应用程序-您的代码在 32/64位系统,您可以使用32位驱动程序.当然是代码 JIT编译器发出的是32位,因此您不能使用64位 64位系统上的驱动程序.
  • You build your application for AnyCPU platform - Your code works fine in 32/64 bit systems, the code emitted by the JIT compiler will have the same bitness of the guest OS. BUT, you could not use 32bit drivers by 64bit apps and viceversa. JET.OleDB.4.0 is 32bit only. End of game if you compile for AnyCPU and run on 64bit. You need a 64bit driver.
  • You build your application for x86 platform - Your code works fine in 32/64 bit systems, and you can use 32bit drivers. Of course the code emitted by the JIT compiler is 32bit and thus you cannot use 64bit drivers on 64bit systems.

这篇关于x64应用程序访问mdb数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆