The configuration of the Grails project data source

Source: Internet
Author: User
Tags grails

There are a lot of documents about the configuration of the Grails project data source, but many of the documents will be grails1.x before, while the configuration of the grails1.x project data source is mostly vague; the Grails Official document also takes a stroke of this content.

Open any document about the configuration of the GRAILS1 data source on the web and tell us about the configuration of the data source in the Datasource.groovy file in the Grails-app/config directory of the Grails project.

The default configuration is:

dataSource {
  pooled = false
  driverClassName = "org.hsqldb.jdbcDriver"
  username = "sa"
  password = ""
}
hibernate {
  cache.use_second_level_cache=true
  cache.use_query_cache=true
  cache.provider_class='org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
  development {
    dataSource {
      dbCreate = "create-drop" // one of 'create', 'create-drop','update'
      url = "jdbc:hsqldb:mem:devDB"
    }
  }
  test {
    dataSource {
      dbCreate = "update"
      url = "jdbc:hsqldb:mem:testDb"
    }
  }
  production {
    dataSource {
      dbCreate = "update"
      url = "jdbc:hsqldb:file:prodDb;shutdown=true"
    }
  }
}

This configuration allows you to connect to the data source that the Grails project brings, which is no longer said.

The first thing I found on the Internet is the following modifications to the data source configuration:

dataSource {
  pooled = false
  driverClassName = "oracle.jdbc.driver.OracleDriver"
  username = "test"
  password = "test"
}
hibernate {
  cache.use_second_level_cache=true
  cache.use_query_cache=true
  cache.provider_class='org.hibernate.cache.EhCacheProvider'
  dialect = org.hibernate.dialect.Oracle9Dialect
}
// environment specific settings
environments {
  development {
    dataSource {
      url = "jdbc:oracle:thin:@172.16.8.54:1430:test"
    }
  }
  test {
    dataSource {
      url = "jdbc:oracle:thin:@172.16.8.54:1430:test"
    }
  }
  production {
    dataSource {
      url = "jdbc:oracle:thin:@172.16.8.54:1430:test"
    }
  }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.