Skip to content

Commit

Permalink
Merge branch 'master' of github.com:grails/grails-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Mar 12, 2015
2 parents 4d3fce2 + 0262561 commit f9cd51e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 44 deletions.
73 changes: 38 additions & 35 deletions src/en/guide/conf/dataSource/multipleDatasources.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,52 @@ environments:
initialSize: 5
{code}

This configures a single @DataSource@ with the Spring bean named @dataSource@. To configure extra @DataSource@s, add a @dataSources@ block (at the top level, in an environment block, or both, just like the standard @DataSource@ definition) with a custom name, separated by an underscore. For example, this configuration adds a second @DataSource@, using MySQL in the development environment and Oracle in production:
This configures a single @DataSource@ with the Spring bean named @dataSource@. To configure extra @DataSource@s, add a @dataSources@ block (at the top level, in an environment block, or both, just like the standard @DataSource@ definition) with a custom name. For example, this configuration adds a second @DataSource@, using MySQL in the development environment and Oracle in production:

{code}
---
dataSources:
dataSource:
pooled: true
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password:
dataSource_lookup:
dialect: org.hibernate.dialect.MySQLInnoDBDialect
driverClassName: com.mysql.jdbc.Driver
username: lookup
password: secret
url: jdbc:mysql://localhost/lookup
dbCreate: update
dataSources:
dataSource:
pooled: true
jmxExport: true
driverClassName: org.h2.Driver
username: sa
password:
lookup:
dialect: org.hibernate.dialect.MySQLInnoDBDialect
driverClassName: com.mysql.jdbc.Driver
username: lookup
password: secret
url: jdbc:mysql://localhost/lookup
dbCreate: update

environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
dataSources:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
dataSources:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
dataSource:
dbCreate: update
url: jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
...
dataSource_lookup:
dialect: org.hibernate.dialect.Oracle10gDialect
driverClassName: oracle.jdbc.driver.OracleDriver
username: lookup
password: secret
url: jdbc:oracle:thin:@localhost:1521:lookup
dbCreate: update
dataSources:
dataSource:
dbCreate: update
url: jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
...
lookup:
dialect: org.hibernate.dialect.Oracle10gDialect
driverClassName: oracle.jdbc.driver.OracleDriver
username: lookup
password: secret
url: jdbc:oracle:thin:@localhost:1521:lookup
dbCreate: update
{code}

You can use the same or different databases as long as they're supported by Hibernate.
Expand Down
11 changes: 2 additions & 9 deletions src/en/ref/Tags/javascript.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,27 @@ h1. javascript

h2. Purpose

Includes JavaScript libraries and scripts as well as providing a shorthand for inline JavaScript. Specifying a library indicates to the Ajax tags which JavaScript provider to use.

This tag is [Resources plugin|http://grails.org/plugin/resources] aware, and will defer to the plugin to generate links to JavaScript as appropriate. It does this by including a resource module with the same name as the library you specify.
Includes JavaScript libraries and scripts as well as providing a shorthand for inline JavaScript.

h2. Examples

{code:xml}
// actually imports '/app/js/myscript.js'
<g:javascript src="myscript.js" />

// imports all the necessary js for the scriptaculous library
<g:javascript library="scriptaculous" />

<g:javascript>alert('hello')</g:javascript>
{code}

h2. Description

If you do not include a "library" or "src" attribute but instead provide a body, the result is an inline script.
If you do not include a "src" attribute but instead provide a body, the result is an inline script.

If you use this tag to render inline JavaScript code, it is recommended that you use the Resources plugin's <r:script> tag to produce inline script that is included at the end of the body, or in the head if necessary - rather than inline. For more control use the Resources plugin's "<r:script>":http://grails-plugins.github.com/grails-resources/ref/Tags/script.html tag directly.

Attributes

* @contextPath@ (optional) - the context path to use (relative to the application context path). Defaults to "" or path to the plugin for a plugin view or template.
* @library@ (optional) - The name of the library to include. Typical values include "jquery", "prototype", "scriptaculous", "yahoo" or "dojo" but plugins can contribute new providers. If the Resources plugin is installed, no link to the library will be rendered immediately. Rather, it will include the resource module with the same name as the library and let Resources do the rest. This means you must have a resource module declared with the same name, as if you had used an @<r:use module="jquery"/>@ tag.
* @src@ (optional) - The name of the JavaScript file to import. Will look in /appname/js directory
* @base@ (optional) - specifies the full base url to prepend to the library name
* @plugin@ (optional) - The plugin to look for the JavaScript in

h2. Source
Expand Down

0 comments on commit f9cd51e

Please sign in to comment.