Author: ate
Date: Tue Feb 26 23:29:55 2013
New Revision: 1450527
URL: http://svn.apache.org/r1450527
Log:
CMS commit to rave by ate
Modified:
rave/site/trunk/content/documentation/configure-database.mdtext
Modified: rave/site/trunk/content/documentation/configure-database.mdtext
URL:
http://svn.apache.org/viewvc/rave/site/trunk/content/documentation/configure-database.mdtext?rev=1450527&r1=1450526&r2=1450527&view=diff
==============================================================================
--- rave/site/trunk/content/documentation/configure-database.mdtext (original)
+++ rave/site/trunk/content/documentation/configure-database.mdtext Tue Feb 26
23:29:55 2013
@@ -20,6 +20,19 @@ Notice: Licensed to the Apache Softwa
In the default setup, Apache Rave uses a file-based [H2 database][1]. Apache
Rave and Apache Shindig run in the same Apache Tomcat server as
separate web applications but share data, so we use H2's [Automatic Mixed
Mode][2].
+## NOTICE upgrading to Rave 0.21+
+As of Rave 0.21 the database access configuration has been changed and moved
to application container provided JNDI resources.
+When upgrading to 0.21+ make sure to update and merge with the default
provided portal.properties and rave.shindig.properties files, which now define
+the new and required JNDI resource lookup names to use:
+
+#### portal.properties
+
+ rave.dataSource.name=jdbc/ravePortalDB
+
+#### rave.shindig.properties
+
+ rave.dataSource.name=jdbc/raveShindigDB
+
### Filling the default database
All schemes are generated using JPA annotations. The H2 database is populated
with low level SQL queries using the DataSourcePopulator which is configured as
Spring bean. These queries are not guaranteed to work for a different database.
@@ -54,13 +67,41 @@ value.
First start with [extending Rave][4].
-Make sure the JDBC driver ends up in the classpath. Either add it to a common
lib directory of the application container or add its dependency to the pom of
the several modules.
+Make sure the JDBC driver ends up in the container classpath as the database
access is provided by the application container through JNDI resource lookup,
so add it to a common lib directory of the application container.
+If you use the Cargo plugin to run or package your application container
setup, replace the dependencies for the com.h2database.h2:jar with your own
JDBC driver jar like in the rave-portal pom.xml (note: 2 times!).
If you remove the H2 JDBC driver from the classpath, you need to override the
`dataContext.xml` Spring configuration file. Remove the configuration for the
H2 Web console. This is the bean with class `org.h2.tools.Server`.
-Then customize the properties for the portal and Shindig to use the database
of your choice.
+Then customize the properties for the portal and Shindig to use the type of
database of your choice.
The default portal properties can be found in
`rave-portal-resources/src/main/resources/portal.properties`, the default
Shindig properties in
`rave-providers/rave-opensocial-provider/rave-opensocial-server/rave-shindig/src/main/resources/rave.shindig.properties`.
+Note: only the database type specific properties, like the
jpa.jpaVendorAdapter.database can be configured in these properties files.
+
+The database connection parameters itself need to be configured in your
project pom.xml (accessible by the Cargo plugin for its run or package goal).
+
+The default connection properties are configured in the main Rave project
pom.xml as follows:
+
+ <!-- Rave default jdbc datasource configuration -->
+
+ <!-- The location of Rave's H2 file DB. No trailing / -->
+ <rave.database.location>/tmp/rave_db</rave.database.location>
+ <rave.dataSource.driver>org.h2.Driver</rave.dataSource.driver>
+ <rave.dataSource.username>sa</rave.dataSource.username>
+ <rave.dataSource.password>local</rave.dataSource.password>
+
<rave.dataSource.url>jdbc:h2:${rave.database.location};AUTO_SERVER=TRUE</rave.dataSource.url>
+
+ <!-- Rave Portal default jdbc datasource configuration: using rave
default configuration shared with Shindig -->
+
<portal.dataSource.driver>${rave.dataSource.driver}</portal.dataSource.driver>
+ <portal.dataSource.url>${rave.dataSource.url}</portal.dataSource.url>
+
<portal.dataSource.username>${rave.dataSource.username}</portal.dataSource.username>
+
<portal.dataSource.password>${rave.dataSource.password}</portal.dataSource.password>
+
+ <!-- Rave Shindig default jdbc datasource configuration: using rave
default configuration shared with Portal -->
+
<shindig.dataSource.driver>${rave.dataSource.driver}</shindig.dataSource.driver>
+ <shindig.dataSource.url>${rave.dataSource.url}</shindig.dataSource.url>
+
<shindig.dataSource.username>${rave.dataSource.username}</shindig.dataSource.username>
+
<shindig.dataSource.password>${rave.dataSource.password}</shindig.dataSource.password>
+As you can see from above, you can provide separate configurations for Rave
Portal or Rave Shindig, although in the default configuration both use the same.
## Sample values
@@ -77,26 +118,23 @@ The default portal properties can be fou
#### Properties
Apache Rave portal:
- jpa.dataSource.url=jdbc:mysql://localhost:3306/rave
- jpa.dataSource.driver=com.mysql.jdbc.Driver
- jpa.dataSource.username=rave
- jpa.dataSource.password=rave
-
jpa.jpaDialect=org.springframework.orm.jpa.DefaultJpaDialect
jpa.jpaVendorAdapter.databasePlatform=org.apache.openjpa.jdbc.sql.MySQLDictionary
jpa.jpaVendorAdapter.database=MYSQL
OpenSocial data (Apache Shindig):
- jpa.dataSource.url=jdbc:mysql://localhost:3306/rave
- jpa.dataSource.driver=com.mysql.jdbc.Driver
- jpa.dataSource.username=rave
- jpa.dataSource.password=rave
-
jpa.jpaDialect=org.springframework.orm.jpa.DefaultJpaDialect
jpa.jpaVendorAdapter.databasePlatform=org.apache.openjpa.jdbc.sql.MySQLDictionary
jpa.jpaVendorAdapter.database=MYSQL
+pom.xml properties:
+
+ <rave.dataSource.driver>com.mysql.jdbc.Driver</rave.dataSource.driver>
+ <rave.dataSource.username>rave</rave.dataSource.username>
+ <rave.dataSource.password>rave</rave.dataSource.password>
+
<rave.dataSource.url>jdbc:mysql://localhost:3306/rave</rave.dataSource.url>
+
#### Notes
The DataSourcePopulator uses a single statement to execute all queries in the
configured SQL files. The MySQL JDBC driver does not allow this by default,
unless you add `allowMultiQueries=true` to the driver URL.
@@ -112,26 +150,23 @@ The DataSourcePopulator uses a single st
#### Properties
Apache Rave portal:
- jpa.dataSource.url=jdbc:postgresql://localhost:5432/rave
- jpa.dataSource.driver=org.postgresql.Driver
- jpa.dataSource.username=rave
- jpa.dataSource.password=rave
-
jpa.jpaDialect=org.springframework.orm.jpa.DefaultJpaDialect
jpa.jpaVendorAdapter.databasePlatform=org.apache.openjpa.jdbc.sql.PostgresDictionary
jpa.jpaVendorAdapter.database=POSTGRESQL
OpenSocial data (Apache Shindig):
- jpa.dataSource.url=jdbc:postgresql://localhost:5432/rave
- jpa.dataSource.driver=org.postgresql.Driver
- jpa.dataSource.username=rave
- jpa.dataSource.password=rave
-
jpa.jpaDialect=org.springframework.orm.jpa.DefaultJpaDialect
jpa.jpaVendorAdapter.databasePlatform=org.apache.openjpa.jdbc.sql.PostgresDictionary
jpa.jpaVendorAdapter.database=POSTGRESQL
+pom.xml properties:
+
+ <rave.dataSource.driver>org.postgresql.Driver</rave.dataSource.driver>
+ <rave.dataSource.username>rave</rave.dataSource.username>
+ <rave.dataSource.password>rave</rave.dataSource.password>
+
<rave.dataSource.url>jdbc:postgresql://localhost:5432/rave</rave.dataSource.url>
+
#### Notes
- The DataSourcePopulator cannot handle a PostgreSQL database that has not
yet been initialized.
- The syntax for setting variables in SQL queries in PostgreSQL is different
from the syntax in H2 databases. Therefore the default data cannot be loaded
using the initial_data.sql file.
@@ -139,31 +174,28 @@ OpenSocial data (Apache Shindig):
### Oracle 10g
#### JDBC driver
-Install the [Oracle JDBC driver][5] in the lib directory of your Apache Tomcat
instance. This driver is not available in a public Maven repository.
+Install the [Oracle JDBC driver][5] in the common/lib directory of your Apache
Tomcat instance. This driver is not available in a public Maven repository.
#### Properties
Apache Rave portal:
- jpa.dataSource.url=jdbc:oracle:thin:@localhost:1521:rave
- jpa.dataSource.driver=oracle.jdbc.OracleDriver
- jpa.dataSource.username=rave
- jpa.dataSource.password=rave
-
jpa.jpaDialect=org.springframework.orm.jpa.DefaultJpaDialect
jpa.jpaVendorAdapter.databasePlatform=org.apache.openjpa.jdbc.sql.OracleDictionary
jpa.jpaVendorAdapter.database=ORACLE
OpenSocial data (Apache Shindig):
- jpa.dataSource.url=jdbc:oracle:thin:@localhost:1521:rave
- jpa.dataSource.driver=oracle.jdbc.OracleDriver
- jpa.dataSource.username=rave
- jpa.dataSource.password=rave
-
jpa.jpaDialect=org.springframework.orm.jpa.DefaultJpaDialect
jpa.jpaVendorAdapter.databasePlatform=org.apache.openjpa.jdbc.sql.OracleDictionary
jpa.jpaVendorAdapter.database=ORACLE
+pom.xml properties:
+
+
<rave.dataSource.driver>oracle.jdbc.OracleDriver</rave.dataSource.driver>
+ <rave.dataSource.username>rave</rave.dataSource.username>
+ <rave.dataSource.password>rave</rave.dataSource.password>
+
<rave.dataSource.url>jdbc:oracle:thin:@localhost:1521:rave</rave.dataSource.url>
+
#### Initial data
The syntax for setting variables in SQL queries in Oracle is different from
the syntax in H2 databases. Therefore the default data cannot be loaded using
the initial_data.sql file.
OpenJPA can create the schema. With help from [Oracle SQL Developer][6] the
minimal set of necessary data can be inserted. The script below inserts the
Apache Rave portal sequences, the page layouts and granted permissions: