No Suitable Driver Found using JDBC

358 Views Asked by At

So, I'm having the following issue: there is no suitable driver found for jdbc://C:/Users/Billy Bob Jones/Documents/My20Y1P2023.accdb . I am using spaces in my name. So, the error I am getting is:

java.sql.SQLException: No suitable driver found for jdbc://C:/Users/Billy Bob Jones/Documents/My20Y1P2023.accdb
    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
    at Ex20_1_2023.main(Ex20_1_2023.java:16)

Note that Billy Bob Jones is not the real name I am using on my computer. Those are merely placeholder names that I am using in order to post this.

Does anyone know how to fix this issue? I am thinking the issue stems from me having spaces in my name.

Thank You!

I already tried using a %20 , a backslash followed by a space, and two backslashes followed by a space, but nothing really worked alongside that.

1

There are 1 best solutions below

0
duffymo On

That error means that the URL you give to the JDBC driver is incorrect. I don't know where you got that URL you're supplying.

Your more serious problem might be the driver itself.

Older JDKs used to have a built-in JDBC-ODBC bridge driver that could connect to MS Access, but it's been removed from the JDK since version 8.

Here is a URL that shows you how to do it with an open source ucanaccess JDBC driver.