All Questions
Tagged with spring-boot mysql
3,441
questions
145
votes
19
answers
306k
views
How to resolve Unable to load authentication plugin 'caching_sha2_password' issue
In eclipse when i started my application i got this - Could not discover the dialect to use. java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.
at java.sql....
141
votes
33
answers
535k
views
Unable to get spring boot to automatically create database schema
I'm unable to get spring boot to automatically load my database schema when I start it up.
Here is my application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource....
107
votes
13
answers
116k
views
Table 'DBNAME.hibernate_sequence' doesn't exist
I have a SpringBoot 2.0.1.RELEASE application using spring data / jpa
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa&...
55
votes
14
answers
124k
views
Spring Boot: Jdbc javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify
I am currently learning more about implementing JDBC and using databases in a Spring Boot webapp, and I encountered the following Stack Trace written in the bottom of the post.
I have created a ...
49
votes
22
answers
142k
views
How to fix "Error executing DDL "alter table events drop foreign key FKg0mkvgsqn8584qoql6a2rxheq" via JDBC Statement"
I'm trying to start a Spring Boot project with a MySQL database, but I have some problem with the database. I try to start my application that, and server is running, but Hibernate doesn’t create ...
48
votes
1
answer
43k
views
Connection to Db dies after >4<24 in spring-boot jpa hibernate
I have an app that uses spring-boot,jpa-hiberanate with mysql.I am getting this error log
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received ...
47
votes
19
answers
160k
views
Failed to load driver class com.mysql.jdbc.Driver
I am trying to run my Spring Boot backend with two profiles, one using H2 in memory database and the second one using MySQL. H2 database works just fine, but when I switch to MySQL I get
APPLICATION ...
46
votes
6
answers
142k
views
Validation failed for query for method JPQL
I am implementing a query which return output in custom object. With my implementation, I am getting an error:
"method public abstract java.util.List org.degs.repository....
44
votes
11
answers
84k
views
java.sql.SQLException: Unknown system variable 'query_cache_size'
I have a app running with JDBC and get data from MySQL, but I can't build it because of this error :
java.sql.SQLException: Unknown system variable 'query_cache_size'
at com.mysql.jdbc.SQLError....
39
votes
6
answers
65k
views
@CreatedDate annotation does not work with mysql
I am new to spring and I am confused how @CreatedDate annotation works in an entity.
I did a google search and there were many solutions, but none of them worked for me except one. I am confused why?...
37
votes
5
answers
44k
views
How to start spring-boot app without depending on Database?
I am using "Spring-boot + Hibernate4 + mysql" for my application. As part of which I have a requirement where my sprint-boot app should be able to start even when database is down. Currently it gives ...
34
votes
4
answers
26k
views
flyway : Unsupported Database: MySQL 8.0
I am using java 11, and I have added flyway in spring-boot application like below.
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation group: 'mysql'...
32
votes
7
answers
188k
views
How to use Spring Boot with MySQL database and JPA?
I want to setting Spring Boot with MySQL and JPA. For this I create:
Person
package domain;
import javax.persistence.*;
@Entity
@Table(name = "person")
public class Person {
@Id
@GeneratedValue
...
29
votes
13
answers
77k
views
How to set correct MySQL JDBC timezone in Spring Boot configuration
DB:
$ mysql --version
mysql Ver 14.14 Distrib 5.6.27, for osx10.10 (x86_64) using EditLine wrapper
Spring Boot: 2.1.1.RELEASE
The error:
2019-01-01 15:56:25.849 ERROR 39957 --- [ restartedMain] ...
28
votes
3
answers
89k
views
Initialising a database before Spring Boot test
I'm using JUnit to test my application and everything works fine as long as the database has been initialised before the testing (using gradle bootRun to run as a web-app). However, if the database is ...
28
votes
6
answers
52k
views
How to add the mode=mysql to embedded H2 DB in Spring Boot 1.4.1 for @DataJpaTest?
I have some problems with using a schema.sql file to create my sql schema when executing a junit test while this schema contains mysql specific expression. I have to add the mode=mysql to the H2 url.
...
25
votes
2
answers
28k
views
Spring Boot: How to use multiple schemas and dynamically choose which one to use at runtime
I have the same question as below, but I want to know the answer.
Spring Boot: How to use multiple schemas and dynamically choose which one to use for every request at runtime
Please help me in ...
24
votes
2
answers
22k
views
Spring retry connection until datasource is available
I have a docker-compose setup to start my SpringBoot application and a MySQL database. If the database starts first, then my application can connect successfully. But if my application starts first, ...
21
votes
4
answers
57k
views
spring jpa application.properties useSSL
I am trying to turn off ssl, to my local mysql database.
But I cannot find the actual property in a spring application.properties file that would do this.
my current file is:
# ======================...
19
votes
8
answers
10k
views
Hibernate saves/retrieves date minus day if application uses another timezone than MySQL
I have an application started on tomcat on MACHINE_A with timezone GMT+3.
I use remote MySQL server started on MACHINE_B with timezone UTC.
We use spring-data-jpa for persistence.
As an example of ...
18
votes
9
answers
38k
views
What causes Spring Boot Fail-safe cleanup (collections) to occur
I have a Java Spring Boot application with the following entities related to the below exception
SProduct
@Entity
@Table(
name = "product",
indexes = @Index(
...
17
votes
7
answers
47k
views
Communications link failure , Spring Boot + MySql +Docker + Hibernate
I'm working with spring boot, hibernate & MySql. While running the application it is running well as per expectation . But while making the docker-compose file and running the app docker image ...
16
votes
3
answers
18k
views
How to tell Spring Boot to use another DB for test?
I'd like Spring Boot to use a MySQL test database that exists next to the application database for integration tests. At the moment, it's using a H2 database automatically because I added the H2 ...
16
votes
3
answers
27k
views
Spring Boot connect Mysql and MongoDb
I have a problem with Spring Boot application. I want to connect a MongoDB database and a MySql database in my Spring boot application. I would to know if it is possible, in positive case How I can ...
16
votes
4
answers
27k
views
Shutting down ExecutorService 'applicationTaskExecutor'
I have a Spring-boot application deployed in docker container within in AWS ECS cluster.
My application stack is => Spring Boot -- JPA -- MySQL RDS
Initially application is deployed and accessible ...
15
votes
12
answers
206k
views
Connect MySQL to Spring application
I want to use MySQL database rather than using runtime database like hsqldb. I have cloned this repository and it is using hsqldb as its database.
As I want to learn how to use relational database ...
15
votes
1
answer
15k
views
Why can I save without @Transactional? [duplicate]
Simplified example:
@Entity
public class Foo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String bar;
// getters + setters
}
public interface ...
14
votes
6
answers
40k
views
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. SPRING
I've already checked all the similar questions and every answer says that I need to specify a driverClassName which I already do. Here is my application.yml:
spring:
application:
name: cibus-...
14
votes
7
answers
45k
views
Unable to connect mysql to spring boot project
i am following this https://spring.io/guides/gs/accessing-data-mysql/ guide to connect mysql db to spring boot project
but getting following error when running the application, i am generating spring ...
13
votes
5
answers
24k
views
Unable to generate difference from liquibase gradle plugin
I'm trying to implement liquibase in an existing SpringBoot project with MYSQL database. I want to be able to generate changesets which specify the differences when an entity is changed.
What I've ...
13
votes
7
answers
55k
views
Cannot load driver class: com.mysql.jdbc.Driver Spring Boot
I was working with Spring Boot project, and suddenly I faced with an issue that application can not load MySQL jdbc.(I compiled this project once without changing anything) This is my pom.xml:
<...
13
votes
1
answer
22k
views
How to init MySql Database in Docker Compose
Scenario:
I developed a microservice in Spring which uses a mysql 8 database.
This db has to be initalized (create a Database, some tables and data).
On my host machine I initialized the database with ...
13
votes
6
answers
39k
views
Spring boot actuator MySQL database health check
I have designed one demo spring boot application CRUD operation with MySQL database. My application.properties file is as follow.
spring.boot.admin.url=http://localhost:8081
spring.datasource.url= ...
13
votes
2
answers
14k
views
Spring Boot SSH Mysql?
I can successfully connect to my openshift mysql through workbench, how do I do the same through my spring boot application?
in my application.properties:
# Connection url for the database
spring....
12
votes
6
answers
14k
views
Spring-Boot, Can't save unicode string in MySql using spring-data JPA
I have my application.properties set up like this :
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.url = jdbc:mysql://localhost:3306/dbname?useUnicode=yes&...
12
votes
1
answer
17k
views
Spring Boot: Communications link failure after some hours of inactivity with Hibernate, JDBC and MySQL [duplicate]
I get this error if my Spring Boot application is inactive for several hours (e.g. during the night):
2015-05-19 09:16:32.666 WARN 20582 --- [http-nio-8080-exec-6] o.h.engine.jdbc.spi....
12
votes
1
answer
27k
views
How to write a spring boot jpa specification joining multiple tables
I want to write below query using spring boot specification.
SELECT o.*
from orders as o
inner join user as u on o.user_id = u.id
inner join user_group as ug on u.user_group_id = ug.id
...
12
votes
4
answers
12k
views
Spring Boot + docker-compose + MySQL: Connection refused
I'm trying to set up a Spring Boot application that depends on a MySQL database called teste in docker-compose. After issuing docker-compose up, I'm getting:
Caused by: java.net.ConnectException: ...
12
votes
2
answers
5k
views
How to configure Spring boot for work with two databases?
I am using Spring Boot 2.X with Hibernate 5 to connect two different MySQL databases (Bar and Foo) on different servers. I am trying to list all the information of an entity (own attributes and @...
11
votes
4
answers
24k
views
How to iterate over large number of records in MySQL with memory efficient manner in Spring Boot
I want to fetch all records from a table using findAll and do some processing on each of them, but I'm not sure if it will give memory issues if the number of records is huge like in millions.
I have ...
10
votes
3
answers
18k
views
Spring-Session with JDBC configuration: Table 'test.spring_session' doesn't exist
I try to run this example but without using Redis, instead with my local MySQL server.
I have edited this spring boot app like this:
Gradle:
buildscript {
repositories {
mavenCentral()
...
10
votes
3
answers
33k
views
Use embedded database for test in spring boot
I have a spring boot application, it has a couple of @Entity classes and @RepositoryRestResource repositort interfaces for them. Now I want to write some tests, where I can check that I can add a new ...
10
votes
1
answer
21k
views
How to use Spring's JdbcTemplate to connect to a simple MySql database?
I am trying to use Spring's JdbcTemplate Class to connect to a simple MySql database based on this tutorial. In fact, I used their project setup:
pom.xml
<project xmlns="http://maven.apache....
10
votes
3
answers
18k
views
Connection lost overnight (spring boot + mysql)
My spring boot application always show me this whitelabel error in the morning: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org....
10
votes
2
answers
9k
views
java.net.UnknownHostException dockerized mysql from spring boot application
I have a spring boot application and dockerized mysql db.
My docker container is up and result of docker ps command below.
cf7936857c6f mysql:5.6 "docker-entrypoint.s…" 7 ...
10
votes
3
answers
19k
views
Spring data JPA: how to enable cascading delete without a reference to the child in the parent?
Maybe this is an overly simple question, but I am getting an exception when I try to delete a user entity.
The user entity:
@Entity
@Table(name = "users")
public class User
{
@Transient
...
10
votes
1
answer
14k
views
Difference between h2 vs hibernate and MySql in general sense
I am while building a spring web came to know about H2,Hibernate.
Earlier while I developed android app I used sqlite or mySQL database.
While using those in new platform I am little bit in a dark ...
10
votes
4
answers
3k
views
Spring Boot MySQL Database Initialization Error with Stored Procedures
In a Spring Boot application I am attempting to initialize some MySQL database tables and stored procedures before running integration tests by placing a schema.sql file in my resources directory as ...
10
votes
1
answer
37k
views
many-to-many-relationship between two entities in spring boot
I have two Entities in my Spring-Boot Application:
User.java
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id;
String firstname;
...
10
votes
1
answer
9k
views
HikariCP - MYSQL No operations allowed after connection closed. Possibly consider using a shorter maxLifetime value
I am using mysql database. It has the default wait timeout of 28800
mysql> SHOW VARIABLES like '%timeout%';
+-----------------------------+----------+
| Variable_name | Value |
+--...