Guest User

Config database and datasource groove

a guest
Mar 18th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. - MAMP PRO 3.2 -
  2. MySQL Server parameters:
  3. Host localhost
  4. Port 3306
  5. User root
  6. Password root
  7. Socket /Applications/MAMP/tmp/mysql/mysql.sock
  8.  
  9. - my DataSource.groovy file -
  10. dataSource {
  11. pooled = true
  12. jmxExport = true
  13. driverClassName = "org.h2.Driver" // i tried it with com.mysql.jdbc.Driver and usr=root and pwd=root
  14. username = "root" // i tried it with sa (with com.mysql.jdbc.Driver and org.h2.Driver)
  15. password = "root" // i tried it with "" (with com.mysql.jdbc.Driver and org.h2.Driver)
  16. }
  17. hibernate {
  18. cache.use_second_level_cache = true
  19. cache.use_query_cache = false
  20. // cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
  21. cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
  22. singleSession = true // configure OSIV singleSession mode
  23. flush.mode = 'manual' // OSIV session flush mode outside of transactional context
  24. }
  25.  
  26. // environment specific settings
  27. environments {
  28. test {
  29. dataSource {
  30. dbCreate = "update"
  31. url = "jdbc:h2:mem:testDb:MVCC=TRUE;LOCK_TIMEOUT=10000"
  32. }
  33. }
  34. development {
  35. dataSource {
  36. dbCreate = "update"
  37. driverClassName = "com.mysql.jdbc.Driver"
  38. dialect = org.hibernate.dialect.MySQL5InnoDBDialect
  39.  
  40. //DEV
  41. url = "jdbc:mysql://localhost:3306/streama"
  42. username = "root"
  43. password = "root"
  44. }
  45. }
  46. production {
  47. dataSource {
  48. dbCreate = "update"
  49. driverClassName = "com.mysql.jdbc.Driver"
  50. dialect = org.hibernate.dialect.MySQL5InnoDBDialect
  51.  
  52. //DEV
  53. url = "jdbc:mysql://localhost:3306/streama"
  54. username = "root"
  55. password = "root"
  56.  
  57. properties {
  58. // See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
  59. jmxEnabled = true
  60. initialSize = 5
  61. maxActive = 50
  62. minIdle = 5
  63. maxIdle = 25
  64. maxWait = 10000
  65. maxAge = 10 * 60000
  66. timeBetweenEvictionRunsMillis = 5000
  67. minEvictableIdleTimeMillis = 60000
  68. validationQuery = "SELECT 1"
  69. validationQueryTimeout = 3
  70. validationInterval = 15000
  71. testOnBorrow = true
  72. testWhileIdle = true
  73. testOnReturn = false
  74. jdbcInterceptors = "ConnectionState"
  75. defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
  76. }
  77. }
  78. }
  79. docker {
  80. dataSource {
  81. dbCreate = "update"
  82. driverClassName = "com.mysql.jdbc.Driver"
  83. dialect = org.hibernate.dialect.MySQL5InnoDBDialect
  84.  
  85. //DEV
  86. String host = System.getenv('MYSQL_HOST')
  87. if(!host) host = "db"
  88. String port = System.getenv('MYSQL_PORT')
  89. if(!port) port = "3306"
  90. String db = System.getenv('MYSQL_DB')
  91. if(!db) db = "streama"
  92. String user = System.getenv('MYSQL_USER')
  93. if(!user) user = "root"
  94. String pass = System.getenv('MYSQL_PASSWORD')
  95. if(!pass) pass = "root"
  96. url = "jdbc:mysql://$host:$port/$db"
  97. username = "$user"
  98. password = "$pass"
  99.  
  100. properties {
  101. // See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
  102. jmxEnabled = true
  103. initialSize = 5
  104. maxActive = 50
  105. minIdle = 5
  106. maxIdle = 25
  107. maxWait = 10000
  108. maxAge = 10 * 60000
  109. timeBetweenEvictionRunsMillis = 5000
  110. minEvictableIdleTimeMillis = 60000
  111. validationQuery = "SELECT 1"
  112. validationQueryTimeout = 3
  113. validationInterval = 15000
  114. testOnBorrow = true
  115. testWhileIdle = true
  116. testOnReturn = false
  117. jdbcInterceptors = "ConnectionState"
  118. defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
  119. }
  120. }
  121. }
  122. }
Add Comment
Please, Sign In to add comment