B4J Code Snippet Opening MS Access databases (mdb)

1. Download UCanAccess: https://www.b4x.com/b4j/files/ucanaccess.zip
(Sources: https://jackcessencrypt.sourceforge.io/ and http://ucanaccess.sourceforge.net/site.html)
The libraries are licensed with Apache 2.0 license: http://www.apache.org/licenses/LICENSE-2.0

2. Copy the jars to the additional libs folder.
3. Add:
B4X:
#AdditionalJar: ucanaccess-5.0.0
#AdditionalJar: commons-lang3-3.8.1
#AdditionalJar: commons-logging-1.2
#AdditionalJar: hsqldb-2.6.1
#AdditionalJar: jackcess-3.0.1-B4J
#IgnoreWarnings: 15
4. There are four text files inside the zip file. Add them to the project Files folder.
5. Open the database:
B4X:
'SQL object from jSQL library
sql.Initialize("net.ucanaccess.jdbc.UcanaccessDriver", "jdbc:ucanaccess://C:/Users/H/Downloads/1.accdb") 'change path as needed
 
Last edited:

Sabotto

Well-Known Member
Licensed User
Here's a demo for accessing .mdb's on Android: https://www.b4x.com/android/forum/t...emo-works-under-b4j-see-notes.121546/#content
If you're looking for accessing encrypted .mdb's on Android, then the above code may work on Android. What you need to watch out for is the library versions that are compatible with Android. For example, UCanAccess is currently at version 5.0.0. This version will not work under Android, you'll have to use 4.0.4.
I would like to access a db access with B4A.
I have read the suggested post, but there is only the code and not the libraries.
Where can I find version 4.0.4? If I go to http://ucanaccess.sourceforge.net/site.html find the last one (the version 5.0.1) which, if I understand correctly, would not work with B4A.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Top