callicoder/spring-boot-mysql-rest-api-tutorial

MySql Exception

josephraj2k16 opened this issue · 9 comments

hi,
I followed the code from your blog,and created the same notes app project.After I built the maven project it shows mysql exception like below:

image

In database side I just created a notes_app schema alone and im using mysql workbench.

Hi,

Can you tell me your Spring Boot version and MySQL version? Also share the mysql-connector-java version if you have specified the version explicitly in the pom.xml file.

I have spring boot (v2.0.0.RELEASE) and I haven't specified MySql version explicitly. here is my pom.xml.

`

4.0.0

<groupId>com.example</groupId>
<artifactId>easy-notes</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>easy-notes</name>
<description>Rest API for a Simple Note Taking Application</description>

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.0.0.RELEASE</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	<java.version>1.8</java.version>
</properties>

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-jpa</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-devtools</artifactId>
		<scope>runtime</scope>
	</dependency>
	<dependency>
		<groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		<scope>runtime</scope>
	</dependency>
	
</dependencies>

<build>
	<plugins>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
		</plugin>
	</plugins>
</build>
`

hi,I just downloaded your project and loaded it in eclipse and still the same error persists,Iam using "Clean install spring-boot:run" command as goals while running as maven build in eclipse.

Hey,

I wanted to know your mysql server version

mysql --version

Also, there is a stackoverflow thread here on this issue. Have you checked that?

i have installed mySql through mysql Installer and here is the version
image

Hi @josephraj2k16 ,

If you have a trouble with mysql and its not important to use mysql, you can test it via H2 db easily

Hi @josephraj2k16, this exception has also occurred for me while working with a similar CRUD app. MySQL server has lost the connection. You just need to reconfigure MySQL server to avoid the exception.

Hi @coding-with-parthasarathi and @josephraj2k16 ,
It has been long time ago :D, but if you still interested about the repo or anyone who might interest can check out my repo below.
I also created a PR for related changes.

https://github.com/ramazansakin/spring-boot-mysql-rest-api-tutorial/tree/master

Hi @coding-with-parthasarathi and @josephraj2k16 , It has been long time ago :D, but if you still interested about the repo or anyone who might interest can check out my repo below. I also created a PR for related changes.

https://github.com/ramazansakin/spring-boot-mysql-rest-api-tutorial/tree/master

Hello, I have a proposal to improve exception handling. If you're interested, I'll create a pull request (PR).