简体   繁体   中英

How to use Microsoft Access database with spring boot and spring data

Here is my application.properties file:

spring.datasource.url=jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=BD_Name.mdb")
spring.datasource.username=
spring.datasource.password=
spring.datasource.driver-class-name=sun.jdbc.odbc.JdbcOdbcDriver
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true

and I use jdk7 which contains the driver sun.jdbc.odbc.JdbcOdbcDriver but when I start, springBoot return the exception "couldn't load driver".

It seems that you want to connect with MS Access, but the driver used is for JDBC.

Change the driver to the following and it should work:

spring.datasource.driver-class-name=net.ucanaccess.jdbc.UcanaccessDriver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM