# How to connect MS Access to Julia using JDBC.jl

**URL:** <https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [January 6, 2022, 4:31pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151 "2022-01-06T16:31:40Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 6, 2022, 4:31pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/1 "2022-01-06T16:31:40Z")

</div>

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

```julia
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.
JDBC.usedriver("/home/me/derby/derby.jar")
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")

```

---

<div class="post-metadata">

**Author:** ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)\
**Post date:** [January 6, 2022, 5:15pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/2 "2022-01-06T17:15:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)\
**Post date:** [January 6, 2022, 6:01pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/3 "2022-01-06T18:01:40Z")

</div>

I’m not familiar with derby, but you could have a look at my (unregistered) package [Access.jl](https://github.com/hellemo/Access.jl), which uses UCanAccess as driver for JDBC.

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 6, 2022, 6:21pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/4 "2022-01-06T18:21:17Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)\
**Post date:** [January 6, 2022, 6:44pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/5 "2022-01-06T18:44:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 6, 2022, 6:58pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/6 "2022-01-06T18:58:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)\
**Post date:** [January 6, 2022, 7:11pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/7 "2022-01-06T19:11:26Z")

</div>

The package isn’t registered, so you have to do  
`] add git@github.com:hellemo/Access.jl.git`  
or

```julia
import Pkg
Pkg.add(url="git@github.com:hellemo/Access.jl.git")

```

Did you try that?

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 6, 2022, 7:13pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/8 "2022-01-06T19:13:18Z")

</div>

Not yet, I’ll try it now!

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 10, 2022, 2:22pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/9 "2022-01-10T14:22:43Z")

</div>

Hi @hellemo

For both attempts Julia gives me this error message:

```julia
ERROR: failed to clone from git@github.com:hellemo/Access.jl.git, error: GitError(Code:ERROR, Class:SSH, Failed to authenticate SSH session : Unable to open public key file)

```

---

<div class="post-metadata">

**Author:** ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)\
**Post date:** [January 10, 2022, 3:03pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/10 "2022-01-10T15:03:36Z")

</div>

Oh, sorry, I guess you need to use the https address rather than the ssh one:  
`https://github.com/hellemo/Access.jl.git`

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 10, 2022, 3:16pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/11 "2022-01-10T15:16:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)\
**Post date:** [January 10, 2022, 6:28pm UTC](https://discourse.julialang.org/t/how-to-connect-ms-access-to-julia-using-jdbc-jl/74151/12 "2022-01-10T18:28:58Z")

</div>

Hello @hellemo

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