How to connect MS Access to Julia using JDBC.jl

Hey guys!
I’m trying to pull data from Access to Julia using an example I found, but it’s not working.

using JDBC
using Access #In the example the Access is being called as if it were a pkg

#To start it, add the database driver jar file to the classpath and then start the JVM.
init() = JavaCall.init()  # ou JavaCall.init()

#The JVM remains in memory unless you explicitly destroy it. It can be done with
destroy() = JavaCall.destroy() # ou JavaCall.destroy ()

fn = "C:\\temp\\TestDatabase.accdb" # github
df = Access.query(fn,"SELECT * FROM Person WHERE BirthYear > 1980")

What if you call the init function you defined before you call Access.query?

1 Like

I’m not familiar with derby, but you could have a look at my (unregistered) package Access.jl, which uses UCanAccess as driver for JDBC.

1 Like

Hi @hellemo

Part of the example is just what I saw in Access.jl that you created, I just didn’t download UCanAccess. Perhaps this is the reason for the error.
Thank you!

I see, note that Access.jl should download the UCanAccess driver automatically during the build step.

I understand, but when I compile using Access it gives an error because I can’t install this package

The package isn’t registered, so you have to do
] add

import Pkg

Did you try that?

Not yet, I’ll try it now!

Hi @hellemo

For both attempts Julia gives me this error message:

ERROR: failed to clone from, error: GitError(Code:ERROR, Class:SSH, Failed to authenticate SSH session : Unable to open public key file)

Oh, sorry, I guess you need to use the https address rather than the ssh one:

1 Like

It worked :smiley:
But now I need to download a JRE/JDK to build Access

Hello @hellemo

Thank you very much for the help, I managed to compile your example