How to write to an Access database on Windows 10

荒凉一梦 提交于 2019-12-23 22:19:34

问题


Because the jdbc odbc bridge is no longer available (see this question/answer), I tried UCanAccess, which works great reading the database, but on Windows 10, throws an error on a write attempt: ([CONCURRENT_PROCESS_ACCESS] - File marked as read only. Notice that only one process (one VM) for time can access in writing mode.).

The same code reads and writes perfectly using the UCanAccess driver on Windows 8.1 and Windows 7.

I am currently unable to tinker since I don't have a Windows 10 system; the tests were performed by a power user on a single Windows 10 install. The mdb file in question was fully accessible by the user. Several path locations for the mdb file were tested (c:\ProgramData, Downloads) with the same result: reads fine, writes fail.

If any Windows 10 user wants to test this for themselves in various directories and possibly manipulating permissions, that would be great.

Here is a link to the mdb file I'm using. Here is a link to the test program (as an exe). Here is a link to the source code.

The test process would be to place the mdb file, then run the test program with the parameter of the path. So at a Windows command prompt, something like:

TestDbAccess c:\my\dir

Where c:\my\dir is where you put the mdb file.

UPDATE: I should have included in the original question that running on actual hardware is what is desired, as opposed to running virtualized in VBox.

UPDATE2: FALSE ALARM: The mdb file in question really was "Access 97" level, based on byte 20 of the file. The problem was that the component that had the task of creating the mdb file somehow created it as "Access 2000" sometimes and "Access 97" at other times. Exactly how that happened still remains a mystery, but it does not appear to depend on the underlying OS version. My advice to anyone who runs into the CONCURRENT_PROCESS_ACCESS error: believe it!


回答1:


UCanAccess and Jackcess do not have a problem with Windows 10 per se. I just used UCanAccess to run this SQL statement ...

UPDATE CW_EPG_CAPTURES SET title = 'Win10 test'

... against your sample database (cw_record.mdb, which is in Access 2000 format) on a VirtualBox virtual machine with

  • Windows 10 Pro Technical Preview, Build 10041 (64-bit)
  • JDK 7u45 (64-bit)
  • NetBeans 7.4
  • UCanAccess 2.0.9.4

and it successfully performed the update without complaint.

The .mdb file was downloaded directly from the link in your question and saved into

C:\Users\Public

Update:

As it turns out, the problem had nothing to do with Windows 10. The issue was simply that an Access 97 file was sometimes being used for testing. Jackcess and UCanAccess just offer read-only support for Access 97 files.



来源:https://stackoverflow.com/questions/29761407/how-to-write-to-an-access-database-on-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!