geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v2.1 > Configuring databases in Geronimo
Date Fri, 18 Jun 2010 03:01:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=GMOxDOC21&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/GMOxDOC21/Configuring+databases+in+Geronimo">Configuring
databases in Geronimo</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~chirunhua@gmail.com">Runhua
Chi</a>
    </h4>
        <br/>
                         <h4>Changes (0)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC21/Administrative+Tasks"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC21/Administrative+Tasks">Administrative
Tasks</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC21/Administration"><img border='0' align='middle' src='/confluence/images/icons/up_16.gif'
width='8' height='8'></a></sup><a href="/confluence/display/GMOxDOC21/Administration">Administration</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/GMOxDOC21/Configuring+Geronimo+as+a+Windows+Service">Configuring
Geronimo as a Windows Service</a></td><td class='ScrollbarNextIcon'><a
href="/confluence/display/GMOxDOC21/Configuring+Geronimo+as+a+Windows+Service"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>

<p>This topic is about how to create a new embedded database in Geronimo with available
<b>DB Manager</b> and configure the location of embedded Derby system database
to another location instead of the default <tt>/var/derby</tt> directory. </p>

<div>
<ul>
    <li><a href='#ConfiguringdatabasesinGeronimo-Creatinganewdatabase'>Creating
a new database</a></li>
    <li><a href='#ConfiguringdatabasesinGeronimo-ConfiguringthelocationofsystemDerbydatabases'>Configuring
the location of system Derby databases</a></li>
</ul></div>

<h1><a name="ConfiguringdatabasesinGeronimo-Creatinganewdatabase"></a>Creating
a new database</h1>
<p>Near the bottom of the <b>Console Navigation</b> menu navigate through
<b>Embedded DB</b> -&gt; <b>DB Manager</b>. This portlet triggers
the <b>DB Viewer</b> and <b>Run SQL</b> portlets illustrated in the
following figures.</p>

<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/75625/DBViewer.gif?version=1&amp;modificationDate=1203353863000"
style="border: 0px solid black" /></span></p>

<p>The <b>DB Viewer</b> portlet displays all the available databases, their
tables (application and system) and the the table contents. Click the Application link to
work with database application tables. Click the System link to work with database system
tables.</p>


<p><span class="image-wrap" style=""><img src="/confluence/download/attachments/75625/DBRunSQL.gif?version=1&amp;modificationDate=1203353863000"
style="border: 0px solid black" /></span></p>


<p>The <b>RunSQL</b> portlet allows you to create or delete databases, or
run SQL commands against a given database. The SQL commands allow you to create, drop, or
modify tables, and select, insert or delete rows from the database tables.</p>

<p>To create a test database, specify <b>test</b> in the <b>Create
DB:</b> field and click <b>Create</b>. After a few seconds you will see
a confirmation message near the bottom of the <b>Run SQL</b> portlet, stating
<b>Database created: test</b>. You will find the <b>test</b> database
entry in the <b>DB Viewer</b> portlet.</p>

<p>If you want to run any SQL command on this database make sure you select <b>test</b>
from the <b>Use DB:</b> pull-down menu, enter the SQL command and then click the
<b>Run SQL</b> button. The results of the command will be displayed near the bottom
of the portlet.</p>

<h1><a name="ConfiguringdatabasesinGeronimo-ConfiguringthelocationofsystemDerbydatabases"></a>Configuring
the location of system Derby databases</h1>
<p>By default, all system databases are created in the <tt>/var/derby</tt>
directory when Geronimo server starts up for the first time. You can override the default
<em>derbySystemHome</em> attribute of the DerbySystem GBean. Find the system-database
module in <tt>/var/config/config.xml</tt> and it looks like as below:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>excerpt of config.xml</b></div><div
class="codeContent panelContent">
<pre class="code-xml">
   <span class="code-tag">&lt;module name=<span class="code-quote">"org.apache.geronimo.configs/system-database/2.2/car"</span>&gt;</span>
       <span class="code-tag">&lt;gbean name=<span class="code-quote">"DerbyNetwork"</span>&gt;</span>
           <span class="code-tag">&lt;attribute name=<span class="code-quote">"host"</span>&gt;</span>${ServerHostname}<span
class="code-tag">&lt;/attribute&gt;</span>
           <span class="code-tag">&lt;attribute name=<span class="code-quote">"port"</span>&gt;</span>${DerbyPort
+ PortOffset}<span class="code-tag">&lt;/attribute&gt;</span>
       <span class="code-tag">&lt;/gbean&gt;</span>
       <span class="code-tag">&lt;gbean name=<span class="code-quote">"DerbySystem"</span>&gt;</span>
         <span class="code-tag">&lt;attribute name=<span class="code-quote">"derbySystemHome"</span>&gt;</span>var/derby<span
class="code-tag">&lt;/attribute&gt;</span>
       <span class="code-tag">&lt;/gbean&gt;</span>
   <span class="code-tag">&lt;/module&gt;</span>
</pre>
</div></div>
<p>Note that <em>derbySystemHome</em> can be configured to an absolute location
or a relative one.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC21/Configuring+databases+in+Geronimo">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=75625&revisedVersion=9&originalVersion=8">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC21/Configuring+databases+in+Geronimo?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message