randomuser
randomuser

Reputation: 51

spring boot connection to localhost database

Is it possible to connect a database from mamp server(localhost) using a spring boot app in eclipse and display data from it? Or how does it work, because I have no idea how to implement that?

 spring.datasource.url=jdbc:mysql://localhost/dbtuts
 spring.datasource.username=root
 spring.datasource.password=root
 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
 spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect

this is what, I've been using for application.properties

Upvotes: 5

Views: 18734

Answers (3)

Saleh Enam Shohag
Saleh Enam Shohag

Reputation: 1119

In case of anyone using MySQL from MAMP. Following Configuration worked for me.

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:8889/join_test?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=root

Upvotes: 0

ShibenDutta
ShibenDutta

Reputation: 450

I am using WAMP server 3.0.6
Default port for MySql is 3306 so the following works for me

spring.datasource.url= jdbc:mysql://localhost:3306/DBname
spring.datasource.username=dbusername
spring.datasource.password=dbpassword
spring.jpa.hibernate.ddl-auto=create-drop

Upvotes: 0

Abhijit Gaikwad
Abhijit Gaikwad

Reputation: 3162

Following settings seem to work fine for me.

spring.datasource.url=jdbc:mysql://localhost:8889/test
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

Upvotes: 4

Related Questions