Skip to content

Commit

Permalink
MySql Connection
Browse files Browse the repository at this point in the history
  • Loading branch information
cw-bhanunadar committed Nov 29, 2023
1 parent 221097c commit 486d4a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {

implementation('io.micronaut.sql:micronaut-jdbc-hikari:4.3.0')
implementation("io.micronaut.data:micronaut-data-jdbc")
runtimeOnly("org.postgresql:postgresql")
runtimeOnly("mysql:mysql-connector-java")


runtimeOnly("org.yaml:snakeyaml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.micronaut.data.jdbc.annotation.JdbcRepository
import io.micronaut.data.model.query.builder.sql.Dialect
import io.micronaut.data.repository.CrudRepository

@JdbcRepository(dialect = Dialect.POSTGRES)
@JdbcRepository(dialect = Dialect.MYSQL)
interface StudentRepository : CrudRepository<Student, Long> {
@Query("Select * from students where name = :name")
suspend fun getStudents(name: String): List<Student>
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
datasources:
default:
url: jdbc:postgresql://localhost:5432/postgresDB?preparedStatementCacheQueries=0
driverClassName: org.postgresql.Driver
username: postgresUser
password: postgresPW
dialect: POSTGRES
url: jdbc:mysql://localhost:3306/my_sql?preparedStatementCacheQueries=0
driverClassName: com.mysql.cj.jdbc.Driver
username: sqlUser
password: sqlPassword
dialect: MYSQL

rabbitmq:
uri: amqp://${RABBITMQ_USER:guest}:${RABBITMQ_PASS:guest}@${RABBITMQ_HOST:localhost}:${RABBITMQ_PORT:5672}
Expand Down

0 comments on commit 486d4a9

Please sign in to comment.