spannm / ucanaccess

Open-source pure Java JDBC driver for Microsoft Access databases. Allows Java developers and client programs (e.g. OpenOffice, LibreOffice, SQuirreL) to read and write various versions of Access databases.
https://spannm.github.io/ucanaccess/
Apache License 2.0
22 stars 2 forks source link

Multiple threads failed to create table simultaneously #14

Closed kiloyqp closed 4 months ago

kiloyqp commented 4 months ago

Version: ucanaccess 5.0.1;jdk 1.8.0 Problem: i need to create and write different mdb files with multiple threads,the mdbs have different table struct;i found that when A thread creates Table A, and B thread sometimes will report an error when creating Table B. The reason for the error is due to the influence of A thread; some log belows:

[DEBUG] 2024-06-26 18:09:05.803 [pool-2-thread-3] MdbWriter - CreateDb Url:jdbc:ucanaccess:///home/gm/GM4C/Bin/./index.mdb;newDatabaseVersion=V2003,SQL:CREATE TABLE PICINDEX ( IDX INTEGER NOT NULL PRIMARY KEY, POLEID VARCHAR(50), SETLOC VARCHAR(50), KM DOUBLE, ST VARCHAR(50), TUNNEL VARCHAR(50), DETECTDATE VARCHAR(50), MDirection VARCHAR(50), SPEED DOUBLE, CAMERANO VARCHAR(50), PATH VARCHAR(50), POLENUM VARCHAR(50), FRONT DOUBLE, BACK DOUBLE, FILEPRE VARCHAR(50), AllReadState VARCHAR(50), CorrectState VARCHAR(50), OldPoleNum VARCHAR(50), DataState VARCHAR(50));

[DEBUG] 2024-06-26 18:09:05.803 [pool-2-thread-2] MdbWriter - CreateDb Url:jdbc:ucanaccess:///home/gm/GM4C/Bin/./FaultIndex.mdb;newDatabaseVersion=V2003,SQL:CREATE TABLE FaultLevel ( LevelID VARCHAR(50) NOT NULL PRIMARY KEY, LevelName VARCHAR(50), DelFlag VARCHAR(50), Memo VARCHAR(100));

[ERROR] 2024-06-26 18:09:05.846 [pool-2-thread-2] MdbWriter - CreateDb Failed,file:/home/gm/GM4C/Bin/./FaultIndex.mdb,Err:UCAExc:::4.x.x java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: PICINDEX

thread-3 should create PICINDEX,thread-2 should create FaultLevel,however, thread-2 create table failed,the error is " user lacks privilege or object not found: PICINDEX",but PICINDEX should create by thread-3.

when i use just one thread to deal all mdb files sequentially,no error wiil happen. Question: do you have know this problem,or does version 5.1.1 has fixed this problem.

spannm commented 4 months ago

Not clear at all what you're trying to achieve, sorry mate

kiloyqp commented 4 months ago

已收到