domingo, 3 de julio de 2022

Conectar proyecto Spring Boot con MySql y PostgreSQL

Configurar la Conexión a la Base de datos:

MySQL connection settings
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/testdb?serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=secret
# JPA settings
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect


--------------------------------------------------------------------------------------------
# Postgresql connection settings
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost/testdb
spring.datasource.username=postgres
spring.datasource.password=secret
# JPA settings
spring.jpa.database=postgresql
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect


Opcional:
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

No hay comentarios:

Publicar un comentario

Instalar MySQL Server en Fedora 42

Instalar MySQL Server en Fedora 42 sudo dnf install mysql8.4-server Habilitar e iniciar el servicio MySQL sudo systemctl enable mysqld sudo ...