0
 File f = new File("MedicalStoreDatabase.accdb"); 
 String Path = f.getAbsolutePath(); 
 Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
 conn = DriverManager.getConnection("jdbc:ucanaccess:"+Path);

Why it's not working. It's give me an error "no suitable driver found net.ucanaccess:C:\Users\username...."

  • Does this answer your question? [UCanAccess: No suitable driver found](https://stackoverflow.com/questions/37121700/ucanaccess-no-suitable-driver-found) – azurefrog Mar 02 '20 at 15:14
  • Does this answer your question? [Manipulating an Access database from Java without ODBC](https://stackoverflow.com/questions/21955256/manipulating-an-access-database-from-java-without-odbc) – Kosonome Mar 02 '20 at 15:27
  • The error suggests you are using the JDBC url `"net.ucanaccess:...`, not `"jdbc:ucanaccess:..."` as shown in your code, which means that you aren't actually running that code that is shown. Please provide a consistent [mre]. – Mark Rotteveel Mar 03 '20 at 17:38

1 Answers1

0

You need put a driver in your classpath/project, usualy a simple .jar or using Maven.

In UCanAccess website, it says here that you need put that into your maven:

groupId:    net.sf.ucanaccess
artifactId:     ucanaccess
version:    5.0.0
Kosonome
  • 470
  • 2
  • 9