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 > Create a database
Date Fri, 18 Jun 2010 02:51: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/Create+a+database">Create
a database</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 (8)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-unchanged" >{scrollbar} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">To
create a new embedded database in Geronimo the *DB Manager* portlet is available. Near the
bottom of the *Console Navigation* menu navigate through *Embedded DB* -&gt; *DB Manager*.
This portlet triggers the *DB Viewer* and *Run SQL* portlets illustrated in the following
figures. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{excerpt}This
topic is about how to create a new embedded database in Geronimo with available *DB Manager*
and configure the location of embedded Derby system database to another location instead of
the default {{/var/derby}} directory.{excerpt}  <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{toc}
<br> <br>h1. Creating a new database <br>Near the bottom of the *Console
Navigation* menu navigate through *Embedded DB* -&gt; *DB Manager*. This portlet triggers
the *DB Viewer* and *Run SQL* portlets illustrated in the following figures. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >!DBViewer.gif! <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >The *DB Viewer* portlet displays
all the available databases, their tables (application and system) and <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">displays</span>
the <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">contents
of</span> the <span class="diff-changed-words">table<span class="diff-added-chars"style="background-color:
#dfd;"> content</span>s.</span> Click the Application link to work with database
application tables. Click <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">on</span>
the System link to work with database system tables. <br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The *RunSQL* 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. <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">To
create a test database specify *test* in the *Create DB:* field and click on *Create*. After
a few seconds you should see a confirmation message near the bottom of the *Run SQL* portlet
stating *Database created: test*. You should now see the *test* database entry in the *DB
Viewer* portlet. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">To
create a test database, specify *test* in the *Create DB:* field and click *Create*. After
a few seconds you will see a confirmation message near the bottom of the *Run SQL* portlet,
stating *Database created: test*. You will find the *test* database entry in the *DB Viewer*
portlet. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >If you want to run any SQL command
on this database make sure you select *test* from the *Use DB:* pull-down menu, enter the
SQL command and then click <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">on</span>
the *Run SQL* button. The results of the command will be displayed near the bottom of the
portlet. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h1. Configuring the location of system Derby databases <br>By default, all
system databases are created in the {{/var/derby}} directory when Geronimo server starts up
for the first time. You can override the default _derbySystemHome_ attribute of the DerbySystem
GBean. Find the system-database module in {{/var/config/config.xml}} and it looks like as
below: <br>{code:xml|title=excerpt of config.xml} <br>   &lt;module name=&quot;org.apache.geronimo.configs/system-database/2.2/car&quot;&gt;
<br>       &lt;gbean name=&quot;DerbyNetwork&quot;&gt; <br>  
        &lt;attribute name=&quot;host&quot;&gt;${ServerHostname}&lt;/attribute&gt;
<br>           &lt;attribute name=&quot;port&quot;&gt;${DerbyPort +
PortOffset}&lt;/attribute&gt; <br>       &lt;/gbean&gt; <br> 
     &lt;gbean name=&quot;DerbySystem&quot;&gt; <br>         &lt;attribute
name=&quot;derbySystemHome&quot;&gt;var/derby&lt;/attribute&gt; <br>
      &lt;/gbean&gt; <br>   &lt;/module&gt; <br>{code} <br>Note
that _derbySystemHome_ can be configured to an absolute location or a relative one. <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/Configuring+Virtual+Hosts+in+Geronimo-Tomcat"><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/Configuring+Virtual+Hosts+in+Geronimo-Tomcat">Configuring
Virtual Hosts in Geronimo-Tomcat</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/Geronimo+Administration+Console">Geronimo
Administration Console</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/GMOxDOC21/Geronimo+Administration+Console"><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='#Createadatabase-Creatinganewdatabase'>Creating a new database</a></li>
    <li><a href='#Createadatabase-ConfiguringthelocationofsystemDerbydatabases'>Configuring
the location of system Derby databases</a></li>
</ul></div>

<h1><a name="Createadatabase-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="Createadatabase-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/Create+a+database">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=75625&revisedVersion=8&originalVersion=7">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC21/Create+a+database?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message