Skip to content

Commit

Permalink
adding jpa and db connection test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbrzustowicz committed Dec 28, 2023
1 parent 6d4b056 commit db09056
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.0.4.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package pl.sebastianbrzustowicz.CrudApp;

import java.sql.Connection;
import java.sql.DriverManager;

public class MySqlConnectionTest {
public static void main(String[] args) {
String url = "jdbc:mysql://localhost:3306/robotTaskerApi?useSSL=false&allowPublicKeyRetrieval=true";
String user = "root";
String password = "sebastian";

try (Connection connection = DriverManager.getConnection(url, user, password)) {
System.out.println("Connected to the database!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
spring.datasource.url=jdbc:mysql://localhost:3306/robotTaskerApi?useSSL=false
spring.datasource.url=jdbc:mysql://localhost:3306/robotTaskerApi?useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=sebastian

0 comments on commit db09056

Please sign in to comment.