Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Menyiapkan Grails 3.1.0 dengan MySQL

Ini milikku

build.gradle:

dependencies {
    runtime 'mysql:mysql-connector-java:5.1.20'

}

Sekarang application.yml:

dataSources:
    dataSource:
        pooled: true
        jmxExport: true
        driverClassName: com.mysql.jdbc.Driver
        dialect: org.hibernate.dialect.MySQL5InnoDBDialect
        username: username
        password: opendoor_policy
    nextdbsource:
        pooled: true
        jmxExport: true
        driverClassName: com.mysql.jdbc.Driver
        dialect: org.hibernate.dialect.MySQL5InnoDBDialect
        username: username
        password: opendoor_policy
        url: jdbc:mysql://localhost:3306/nextdbsource?autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8
        dbCreate: update

environments:
    development:
        dataSources:
            dataSource:
                dbCreate: update
                url: jdbc:mysql://localhost:3306/db1?autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8
    test:
        dataSources:
            dataSource:
                dbCreate: update
                url: jdbc:mysql://localhost:3306/db1?autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8
    production:
        dataSources:
            dataSource:
                dbCreate: update
                url: jdbc:mysql://localhost:3306/db1?autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8
                properties:
                    jmxEnabled: true
                    initialSize: 5
                    maxActive: 50
                    minIdle: 5
                    maxIdle: 25
                    maxWait: 10000
                    maxAge: 600000
                    timeBetweenEvictionRunsMillis: 5000
                    minEvictableIdleTimeMillis: 60000
                    validationQuery: SELECT 1
                    validationQueryTimeout: 3
                    validationInterval: 15000
                    testOnBorrow: true
                    testWhileIdle: true
                    testOnReturn: false
                    jdbcInterceptors: ConnectionState
                    defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED

---

yang berfungsi untuk saya dan menyiapkan 2 sumber data




  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Bagaimana cara mengatur pemeriksaan dengan mysqli?

  2. KESALAHAN 1878 (HY000):Kegagalan penulisan file sementara

  3. Gabungkan 2 kueri SELECT LEFT JOIN, gabungkan/deklarasikan AS tidak berfungsi

  4. Hasil cetak Python dan MySQL

  5. masalah dengan persiapan mysqli