Author: hiranya
Date: Sun Jan  2 11:15:17 2011
New Revision: 1054385

URL: http://svn.apache.org/viewvc?rev=1054385&view=rev
Log:
DB setup guide

Modified:
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample360.xml
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample361.xml
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample362.xml
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample363.xml
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml
    
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/setup/db.xml

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample360.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample360.xml?rev=1054385&r1=1054384&r2=1054385&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample360.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample360.xml
 Sun Jan  2 11:15:17 2011
@@ -124,7 +124,7 @@
                 <p>
                     <ul>
                         <li>
-                            Setup a Derby database as described in the 
database setup guide
+                            Setup a Derby database as described in the <a 
href="setup/db.html">database setup guide</a>
                         </li>
                         <li>
                             Deploy the SimpleStockQuoteService in the sample 
Axis2 server and start Axis2

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample361.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample361.xml?rev=1054385&r1=1054384&r2=1054385&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample361.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample361.xml
 Sun Jan  2 11:15:17 2011
@@ -74,7 +74,7 @@
                 <p>
                     <ul>
                         <li>
-                            Setup a Derby database as described in the 
database setup guide
+                            Setup a Derby database as described in the <a 
href="setup/db.html">database setup guide</a>
                         </li>
                         <li>
                             Deploy the SimpleStockQuoteService in the sample 
Axis2 server and start Axis2

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample362.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample362.xml?rev=1054385&r1=1054384&r2=1054385&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample362.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample362.xml
 Sun Jan  2 11:15:17 2011
@@ -100,7 +100,7 @@
                 <p>
                     <ul>
                         <li>
-                            Setup a Derby database as described in the 
database setup guide
+                            Setup a Derby database as described in the <a 
href="setup/db.html">database setup guide</a>
                         </li>
                         <li>
                             Deploy the SimpleStockQuoteService in the sample 
Axis2 server and start Axis2

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample363.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample363.xml?rev=1054385&r1=1054384&r2=1054385&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample363.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample363.xml
 Sun Jan  2 11:15:17 2011
@@ -163,7 +163,7 @@
                     <ul>
                         <li>
                             Setup a Derby database and the Synapse data 
sources as described in the
-                            database setup guide
+                            <a href="setup/db.html">database setup guide</a>
                         </li>
                         <li>
                             Deploy the SimpleStockQuoteService in the sample 
Axis2 server and start Axis2

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml?rev=1054385&r1=1054384&r2=1054385&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample364.xml
 Sun Jan  2 11:15:17 2011
@@ -97,7 +97,7 @@
                 <p>
                     <ul>
                         <li>
-                            Setup a MySQL database as described in the 
database setup guide
+                            Setup a MySQL database as described in the <a 
href="setup/db.html#mysql">database setup guide</a>
                         </li>
                         <li>
                             Deploy the SimpleStockQuoteService in the sample 
Axis2 server and start Axis2

Modified: 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/setup/db.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/setup/db.xml?rev=1054385&r1=1054384&r2=1054385&view=diff
==============================================================================
--- 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/setup/db.xml
 (original)
+++ 
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/setup/db.xml
 Sun Jan  2 11:15:17 2011
@@ -29,6 +29,7 @@
                 <li><a href="#derby">Setting Up Apache Derby</a></li>
                 <li><a href="#mysql">Setting Up MySQL</a></li>
                 <li><a href="#other">Using Other Database Engines</a></li>
+                <li><a href="#ds">Setting Up Data Sources</a></li>
             </ul>
         </section>
         <section name="Introduction" id="intro">
@@ -37,8 +38,8 @@
                 JDBC. Any database engine that provides JDBC drivers can be 
integrated with
                 Synapse using the dblookup and dbreport mediators. Synapse 
ships with a collection
                 of samples which demonstrates various aspects of dblookup, 
dbreport mediators and
-                database integration. This article describes how to setup the 
databases and
-                sample tables required to try these examples out.
+                database integration. This article describes how to setup the 
databases, sample
+                tables and JNDI data sources required to try these examples 
out.
             </p>
             <p>
                 Most samples assume Apache Derby is used as the database 
engine. And therefore this
@@ -104,7 +105,7 @@ INSERT into company values ('MSFT','c3',
                 create two stored procedures.
             </p>
             <div class="command">CREATE PROCEDURE getCompany(compName 
VARCHAR(10)) SELECT name, id, price FROM company WHERE name = compName;
-        CREATE PROCEDURE updateCompany(compPrice DOUBLE,compName VARCHAR(10)) 
UPDATE company SET price = compPrice WHERE name = compName;</div>
+CREATE PROCEDURE updateCompany(compPrice DOUBLE,compName VARCHAR(10)) UPDATE 
company SET price = compPrice WHERE name = compName;</div>
             <p>
                 Then you should download the <a 
href="http://www.mysql.com/products/connector/";>MySQL JDBC driver</a>
                 and deploy it into the 'lib' directory of Synapse.
@@ -123,5 +124,70 @@ INSERT into company values ('MSFT','c3',
                 </li>
             </ul>
         </section>
+        <section name="Setting Up Data Sources">
+            <p>
+                Synapse is capable of connecting to databases through 
predefined data sources.
+                This enables database connection pooling and connection reuse. 
Different instances
+                of the database mediators (dblookup/dbreport) can either use 
different data sources
+                or share the same data source.
+            </p>
+            <p>
+                Data sources are configured in the synapse.properties file 
which can be found in the
+                'lib' directory of the Synapse installation. Currently Synapse 
supports following
+                types of data sources.
+            </p>
+            <ul>
+                <li>BasicDataSource</li>
+                <li>PerUserPoolDataSource</li>
+            </ul>
+            <p>
+                Both these types of data sources are based on <a 
href="http://commons.apache.org/dbcp";>Apache DBCP</a>.
+            </p>
+            <p>
+                Following section describes how to setup two data sources as 
required by some of the
+                database integration samples of Synapse. First, it is required 
to setup two
+                Derby databases. So launch 'ij' client tool for Derby and 
create two databases
+                named 'lookupdb' and 'reportdb'. Specify the username and 
password to be 'synapse'
+                for both databases. Create the 'company' table in each 
database and add some sample
+                data as described under <a href="#derby">Setting Up Apache 
Derby</a> section.
+            </p>
+            <p>
+                Now you can define two data sources for these databases by 
adding the following
+                entries to the synapse.properties file.
+            </p>
+            <div class="consoleOutput">synapse.datasources=lookupds,reportds
+synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
+synapse.datasources.providerUrl=rmi://localhost:2199
+synapse.datasources.providerPort=2199
+
+synapse.datasources.lookupds.type=BasicDataSource
+synapse.datasources.lookupds.driverClassName=org.apache.derby.jdbc.ClientDriver
+synapse.datasources.lookupds.url=jdbc:derby://localhost:1527/lookupdb;create=false
+synapse.datasources.lookupds.username=synapse
+synapse.datasources.lookupds.password=synapse
+synapse.datasources.lookupds.dsName=lookupdb
+synapse.datasources.lookupds.maxActive=100
+synapse.datasources.lookupds.maxIdle=20
+synapse.datasources.lookupds.maxWait=10000
+
+synapse.datasources.reportds.type=PerUserPoolDataSource
+synapse.datasources.reportds.cpdsadapter.factory=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
+synapse.datasources.reportds.cpdsadapter.className=org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS
+synapse.datasources.reportds.cpdsadapter.name=cpds
+synapse.datasources.reportds.dsName=reportdb
+synapse.datasources.reportds.driverClassName=org.apache.derby.jdbc.ClientDriver
+synapse.datasources.reportds.url=jdbc:derby://localhost:1527/reportdb;create=false
+synapse.datasources.reportds.username=synapse
+synapse.datasources.reportds.password=synapse
+synapse.datasources.reportds.maxActive=100
+synapse.datasources.reportds.maxIdle=20
+synapse.datasources.reportds.maxWait=10000</div>
+            <p>
+                Here we are defining two data sources named 'lookupds' and 
'reportds'. The first
+                data source is defined as a BasicDataSource and the other one 
is defined as a
+                PerUserPoolDataSource. Note the various parameters we have 
specified for each
+                data source thereby further customizing the behavior of each 
data source.
+            </p>
+        </section>
     </body>
 </document>
\ No newline at end of file


Reply via email to