Guest User

Untitled

a guest
Sep 4th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. Extending multiple grails DataSources in DataSources.groovy?
  2. dataSource1 {
  3. dbCreate = "update"
  4. dialect = org.hibernate.dialect.Oracle10gDialect
  5. pooled = false
  6. jndiName = "java:something"
  7. }
  8. dataSource2 {
  9. pooled = true
  10. driverClassName = "org.hsqldb.jdbcDriver"
  11. username = "sa"
  12. password = ""
  13. dbCreate = "update"
  14. url = "jdbc:hsqldb:mem:testDb"
  15. }
  16.  
  17. // environment specific settings
  18. environments {
  19. //extend datasource1
  20. production{
  21. }
  22. //extend datasource2
  23. development{
  24. }
  25. }
  26.  
  27. dataSource1 = {
  28. dbCreate = "update"
  29. driverClassName = "org.hsqldb.jdbcDriver"
  30. dialect = org.hibernate.dialect.Oracle10gDialect
  31. pooled = false
  32. jndiName = "java:something"
  33. }
  34.  
  35. dataSource2 = {
  36. pooled = true
  37. driverClassName = "org.hsqldb.jdbcDriver"
  38. username = "sa"
  39. password = ""
  40. dbCreate = "update"
  41. url = "jdbc:hsqldb:mem:testDb"
  42. }
  43.  
  44. environments {
  45. production {
  46. dataSource {
  47. dataSource1.call()
  48. }
  49. }
  50. development {
  51. dataSource {
  52. dataSource2.call()
  53. }
  54. }
  55. }
  56.  
  57. environments {
  58. production {
  59. dataSource {
  60. dbCreate = "update"
  61. dialect = org.hibernate.dialect.Oracle10gDialect
  62. pooled = false
  63. jndiName = "java:something"
  64. }
  65. }
  66. }
  67.  
  68. if (System.properties["${appName}.config.location"]) {
  69. grails.config.locations = ["file:" + System.properties["${appName}.config.location"]]
  70. }
Add Comment
Please, Sign In to add comment