Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:
Property: driverclassname
Value: oracle.jdbc.OracleDriver
Origin: "driverClassName" from property source "source"
Reason: Unable to set value for property driver-class-name
Action:
Update your application's configuration
This is
same issue
I have but i am not using maven.
I am using
spring Boot 2.0.0
with following starters.
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1"
testCompile "org.springframework.boot:spring-boot-starter-test"
And this is my application.properties
file
spring.datasource.url= *****
spring.datasource.username= ******
spring.datasource.password= ******
Look up application.properties file.
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
Full code.
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=upate
spring.datasource.url=jdbc:mysql://localhost:3306/database_name
spring.datasource.username=admin
spring.datasource.password=admin1234
As Stephane Nicoll said, you don't have driver on your classpath. You need to include jdbc driver on your gradle build as below. However, you don't have to stick to driver version that I have included.
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1"
testCompile "org.springframework.boot:spring-boot-starter-test"
runtime('com.oracle:ojdbc7:12.1.0.2.0')
–
–
–
I have added the below in properties file
spring.datasource.driverclassname = com.mysql.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
and added the below in POM file
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
It is working fine now.
–
We have to add the dependency and have to remove property "spring.datasource.driver-class-name"
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
–
–
If youre running intelliJ and run into this issue just add this dependency in your pom.xml file:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
This happened to me as well.
But after adding the correct MySQL version in my pom.xml, and explicitly adding the driver details to application.properties resolved the issue.
Application.properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
pom.xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
</dependency>
Add the MySQL version to pom.xml as per the version installed.
Check your pom.xml if you dont have the mysql dependency, can add like this
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
Befor of update the file, run maven
mvn clean install
to update your maven's dependencies
I had the same error, the mistake was in pom.xml file. I had a mistake in my SQL connector dependency. If its okay in your case check also application.properties file you may not include driver
spring.datasource.url=jdbc:mysql://localhost:3307/test?useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.show-sql=true
spring.jpa.generate-ddl=false
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.mvc.view.prefix = /WEB-INF/jsp/
spring.mvc.view.suffix = .jsp
All of these answers require code changes, and in my situation the code wasn't the problem. The error would occur randomly in my development environment, seamingly for no reason, not associated with any config or code change that I'd made.
I think I've found a consistent way to fix it, but I'm not sure why it works.
Shut down InteliJ IDEA
Delete ".idea" and "build" folders
Restart IDEA
This seems to resolve it, but the random nature of this really bothers me. I don't know why it occurs, or why the above fixes it.
I'm just adding this in case it helps others.
Add or modify the application.properties file.
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
Older version used:
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
This does NOT work anymore; hence, the change to spring.jpa.properties.hibernate.dialect.
Resulting in the following:
spring.datasource.url=jdbc:mysql://localhost:3306/<db name>
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=<db username>
spring.datasource.password=<db password>
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.database=mysql
spring.jpa.show-sql=true
Clean the build artifacts from previous builds
mvn clean install
An for IntelliJ, invalidate the cache and restart.
File --> Invalidate Caches...
Run the project.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.