java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Exception occurring. Why?

后端 未结 5 1830
暗喜
暗喜 2020-11-22 09:13

I have created an MS Access database and assigned a DSN to it. I want to access it through my Java application.

This is what I am doing:

public class         


        
5条回答
  •  情歌与酒
    2020-11-22 10:09

    add these dependecies to your .pom file:

    
      org.hsqldb
      hsqldb
      2.5.0
      test
    
    
    
      com.healthmarketscience.jackcess
      jackcess-encrypt
      3.0.0
    
    
    
      net.sf.ucanaccess
      ucanaccess
      5.0.0
    
    
    
      org.apache.commons
      commons-lang3
      3.9
    
    
    
      commons-logging
      commons-logging
      1.2
    
    

    and add to your code to call a driver:

    Connection conn = DriverManager.getConnection("jdbc:ucanaccess://{file_location}/{accessdb_file_name.mdb};memory=false");
    

提交回复
热议问题