You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by bu...@apache.org on 2011/09/14 14:21:21 UTC
svn commit: r795736 -
/websites/staging/rave/trunk/content/rave/documentation/configure-database.html
Author: buildbot
Date: Wed Sep 14 12:21:21 2011
New Revision: 795736
Log:
Staging update by buildbot
Modified:
websites/staging/rave/trunk/content/rave/documentation/configure-database.html
Modified: websites/staging/rave/trunk/content/rave/documentation/configure-database.html
==============================================================================
--- websites/staging/rave/trunk/content/rave/documentation/configure-database.html (original)
+++ websites/staging/rave/trunk/content/rave/documentation/configure-database.html Wed Sep 14 12:21:21 2011
@@ -70,12 +70,39 @@
<h1 class="title">Configure the databases</h1>
<h2 id="default_setup">Default setup</h2>
<p>In the default setup Rave uses an in memory <a href="http://www.h2database.com/">H2 database</a>.</p>
-<p>All schemas 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.</p>
-<p>To access the tables for the portal, go to <a href="http://localhost:11111">http://localhost:11111</a>.
-To access the tables for the OpenSocial container (Shindig), go to <a href="http://localhost:22222">http://localhost:22222</a>. Username is <code>sa</code>, password <code>local</code>.</p>
+<h3 id="filling_the_default_database">Filling the default database</h3>
+<p>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.</p>
+<div class="codehilite"><pre><span class="nt"><bean</span> <span class="na">id=</span><span class="s">"dataSourcePopulator"</span> <span class="na">class=</span><span class="s">"org.apache.rave.jdbc.util.DataSourcePopulator"</span><span class="nt">></span>
+ <span class="nt"><property</span> <span class="na">name=</span><span class="s">"executeScriptQuery"</span> <span class="na">value=</span><span class="s">"SELECT * FROM WIDGET"</span><span class="nt">/></span>
+ <span class="nt"><property</span> <span class="na">name=</span><span class="s">"scriptLocations"</span><span class="nt">></span>
+ <span class="nt"><list></span>
+ <span class="nt"><value></span>classpath:initial_data.sql<span class="nt"></value></span>
+ <span class="nt"></list></span>
+ <span class="nt"></property></span>
+<span class="nt"></bean></span>
+</pre></div>
+
+
+<p>If the query in <code>executeScriptQuery</code> returns no error and no results, the database will be populated with the contents of <code>scriptLocations</code>.</p>
+<h3 id="access_the_default_database">Access the default database</h3>
+<p>.When the application is running the H2 databases can be accessed through a web interface. In the default setup this is configured using a Spring bean:</p>
+<div class="codehilite"><pre><span class="nt"><bean</span> <span class="na">id=</span><span class="s">"org.h2.tools.Server-WebServer"</span> <span class="na">class=</span><span class="s">"org.h2.tools.Server"</span>
+ <span class="na">factory-method=</span><span class="s">"createWebServer"</span> <span class="na">depends-on=</span><span class="s">"dataSource"</span>
+ <span class="na">init-method=</span><span class="s">"start"</span> <span class="na">lazy-init=</span><span class="s">"false"</span> <span class="na">destroy-method=</span><span class="s">"stop"</span><span class="nt">></span>
+ <span class="nt"><constructor-arg</span> <span class="na">value=</span><span class="s">"-web,-webPort,11111"</span><span class="nt">/></span>
+<span class="nt"></bean></span>
+</pre></div>
+
+
+<p>The default username is <code>sa</code>, password <code>local</code>.</p>
+<ul>
+<li>Portal database: <a href="http://localhost:11111">http://localhost:11111</a>.<br />
+</li>
+<li>Shindig database: <a href="http://localhost:22222">http://localhost:22222</a>.</li>
+</ul>
<h2 id="setup_a_different_database">Setup a different database</h2>
<p>First start with <a href="rave-extensions.html">extending Rave</a>.</p>
-<p>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.</p>
+<p>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.</p>
<p>Then customize the properties for the portal and Shindig to use the database of your choice.</p>
<h2 id="sample_values">Sample values</h2>
<h3 id="mysql">MySQL</h3>
@@ -114,7 +141,7 @@ To access the tables for the OpenSocial
<h4 id="notes">Notes</h4>
-<p>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 <code>allowMultiple=true</code> to the driver url.</p>
+<p>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 <code>allowMultiple=true</code> to the driver URL.</p>
<h3 id="postgresql">PostgreSQL</h3>
<h4 id="jdbc_driver_1">JDBC driver</h4>
<div class="codehilite"><pre><span class="nt"><dependency></span>
@@ -151,7 +178,10 @@ To access the tables for the OpenSocial
<h4 id="notes_1">Notes</h4>
-<p>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.</p>
+<ul>
+<li>The DataSourcePopulator cannot handle a PostgreSQL database that has not yet been initialized.</li>
+<li>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.</li>
+</ul>
</div>
<div id="footer">