geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v3.0 > Configuring a MySQL datasource
Date Fri, 28 Jan 2011 09:16:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2036/9/4/_/styles/combined.css?spaceKey=GMOxDOC30&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/GMOxDOC30/Configuring+a+MySQL+datasource">Configuring
a MySQL datasource</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~maojia508">maojia</a>
    </h4>
        <br/>
                         <h4>Changes (13)</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-changed-lines" >{excerpt}This articles shows you
how to configure a mysql datasource in Geronimo.{excerpt} Geronimo is embedded with mysql
resource adapters supporting both local and XA <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">transactions,
you</span> <span class="diff-added-words"style="background-color: #dfd;">transactions.
You</span> need to install mysql JDBC drivers <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">by
yourself</span> as instructed. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>There are two ways to configure
a mysql datasource: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>h1.Creating a datasource
and deploying it as a standalone JEE connector module <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">#
Refer to the attachment [^sample-mysql-xa-ds-plan-standalone.xml] to create a standalone JEE
connector deployment plan <br># Install the mysql jdbc driver to geronimo repository
via the adminitrative console, and ensure its Module ID is the same as the defined one in
the sample plan. In this example, the Module ID of mysql JDBC driver is {{mysql/mysql-connector-java/5.1.7/jar}}.
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">#
See the attachment [^sample-mysql-xa-ds-plan-standalone.xml] to create a standalone Java EE
connector deployment plan. <br># Install the mysql jdbc driver to the Geronimo repository
by using the adminitration console, and ensure its Module ID is the same as the one defined
in the sample plan. In this example, the Module ID of mysql JDBC driver is {{mysql/mysql-connector-java/5.1.7/jar}}.
<br></td></tr>
            <tr><td class="diff-changed-lines" ># Use [command line|Deploying
and undeploying applications#Deployer tool] to deploy <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">it.</span>
<span class="diff-added-words"style="background-color: #dfd;">the datasource.</span>
Here is the sample command for <span class="diff-added-words"style="background-color: #dfd;">deploying</span>
mysql xa datasource: <br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br>&lt;geronimo_home&gt;/bin/deploy.sh
-u system -p manager deploy  <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br>where _&lt;geronimo_home&gt;_
is the installation directory of Geronimo. <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">#
Then you will able to use the datasource via its jndi name _java:comp/env/jdbc/mysqlxads_.
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">#
Now you are able to use the datasource with its jndi name _java:comp/env/jdbc/mysqlxads_.
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>h1. Embedding a datasource
definition in an application deployment plan <br></td></tr>
            <tr><td class="diff-changed-lines" ># <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Refer
to</span> <span class="diff-added-words"style="background-color: #dfd;">See</span>
the attachment [^sample-mysql-xa-ds-plan-embeded.xml] to create an application deployment
plan, <span class="diff-added-words"style="background-color: #dfd;">and</span>
replace <span class="diff-added-words"style="background-color: #dfd;">the</span>
web module and <span class="diff-added-words"style="background-color: #dfd;">the</span>
ejb module according to your application. <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">#
Install the mysql jdbc driver to geronimo repository via the adminitrative console, and ensure
its Module ID is the same as the defined one in the sample plan. In this example, the Module
ID of mysql JDBC driver is {{mysql/mysql-connector-java/5.1.7/jar}}. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">#
Install the mysql jdbc driver to the Geronimo repository by using the adminitration console,
and ensure its Module ID is the same as the one defined in the sample plan. In this example,
the Module ID of mysql JDBC driver is {{mysql/mysql-connector-java/5.1.7/jar}}. <br></td></tr>
            <tr><td class="diff-changed-lines" ># Use command line or adminitrative
console to [deploy|Deploying and undeploying applications] your application with the <span
class="diff-added-words"style="background-color: #dfd;">deployment</span> plan. For
example, <span class="diff-added-words"style="background-color: #dfd;">use</span>
the <span class="diff-added-words"style="background-color: #dfd;">following</span>
command <span class="diff-changed-words">line<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">
as follows</span>:</span> <br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br>&lt;geronimo_home&gt;/bin/deploy.sh
-u system -p manager deploy yourapp.ear sample-mysql-xa-ds-plan-embeded.xml <br>{noformat}
<br>where _&lt;geronimo_home&gt;_ is the installation directory of Geronimo.
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">#
Then you will able to use the datasource via its jndi name _java:comp/env/jdbc/mysqlxads_
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">#
Now you are able to use the datasource with its jndi name _java:comp/env/jdbc/mysqlxads_.
<br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >The transaction configuration
element is something <span class="diff-changed-words">like<span class="diff-added-chars"style="background-color:
#dfd;"> the following</span>:</span> <br></td></tr>
            <tr><td class="diff-unchanged" >{code:xml} <br>&lt;connectionmanager&gt;
<br></td></tr>
            <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/GMOxDOC30/Configuring+a+DB2+datasource"><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/GMOxDOC30/Configuring+a+DB2+datasource">Configuring
a DB2 datasource</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC30/Configuring+datasource"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC30/Configuring+datasource">Configuring datasource</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/GMOxDOC30/Import+database+pools+from+JBoss+4">Import
database pools from JBoss 4</a></td><td class='ScrollbarNextIcon'><a
href="/confluence/display/GMOxDOC30/Import+database+pools+from+JBoss+4"><img border='0'
align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>

<p>This articles shows you how to configure a mysql datasource in Geronimo. Geronimo
is embedded with mysql resource adapters supporting both local and XA transactions. You need
to install mysql JDBC drivers as instructed.</p>

<p>There are two ways to configure a mysql datasource:</p>
<ul>
	<li><a href="#ConfiguringaMySQLdatasource-CreatingadatasourceanddeployingitasastandaloneJEEconnectormodule">Creating
a datasource and deploying it as a standalone JEE connector module</a></li>
	<li><a href="#ConfiguringaMySQLdatasource-Embeddingadatasourcedefinitioninanapplicationdeploymentplan">Embedding
a datasource definition in an application deployment plan</a></li>
</ul>



<h1><a name="ConfiguringaMySQLdatasource-CreatingadatasourceanddeployingitasastandaloneJEEconnectormodule"></a>Creating
a datasource and deploying it as a standalone JEE connector module</h1>
<ol>
	<li>See the attachment <a href="/confluence/download/attachments/20645327/sample-mysql-xa-ds-plan-standalone.xml?version=1&amp;modificationDate=1232503735000">sample-mysql-xa-ds-plan-standalone.xml</a>
to create a standalone Java EE connector deployment plan.</li>
	<li>Install the mysql jdbc driver to the Geronimo repository by using the adminitration
console, and ensure its Module ID is the same as the one defined in the sample plan. In this
example, the Module ID of mysql JDBC driver is <tt>mysql/mysql-connector-java/5.1.7/jar</tt>.</li>
	<li>Use <a href="/confluence/display/GMOxDOC30/Deploying+and+undeploying+applications#Deployingandundeployingapplications-Deployertool">command
line</a> to deploy the datasource. Here is the sample command for deploying mysql xa
datasource:
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;geronimo_home&gt;/bin/deploy.sh -u system -p manager deploy 
&lt;GERONIMO_HOME&gt;/repository/org/tranql/tranql-connector-mysql-xa/1.2/tranql-connector-mysql-xa-1.2.rar
sample-mysql-xa-ds-plan-standalone.xml
</pre>
</div></div>
<p>where <em>&lt;geronimo_home&gt;</em> is the installation directory
of Geronimo.</p></li>
	<li>Now you are able to use the datasource with its jndi name <em>java:comp/env/jdbc/mysqlxads</em>.</li>
</ol>


<h1><a name="ConfiguringaMySQLdatasource-Embeddingadatasourcedefinitioninanapplicationdeploymentplan"></a>Embedding
a datasource definition in an application deployment plan</h1>
<ol>
	<li>See the attachment <a href="/confluence/download/attachments/20645327/sample-mysql-xa-ds-plan-embeded.xml?version=1&amp;modificationDate=1232503735000">sample-mysql-xa-ds-plan-embeded.xml</a>
to create an application deployment plan, and replace the web module and the ejb module according
to your application.</li>
	<li>Install the mysql jdbc driver to the Geronimo repository by using the adminitration
console, and ensure its Module ID is the same as the one defined in the sample plan. In this
example, the Module ID of mysql JDBC driver is <tt>mysql/mysql-connector-java/5.1.7/jar</tt>.</li>
	<li>Use command line or adminitrative console to <a href="/confluence/display/GMOxDOC30/Deploying+and+undeploying+applications"
title="Deploying and undeploying applications">deploy</a> your application with the
deployment plan. For example, use the following command line:
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>&lt;geronimo_home&gt;/bin/deploy.sh -u system -p manager deploy yourapp.ear
sample-mysql-xa-ds-plan-embeded.xml
</pre>
</div></div>
<p>where <em>&lt;geronimo_home&gt;</em> is the installation directory
of Geronimo.</p></li>
	<li>Now you are able to use the datasource with its jndi name <em>java:comp/env/jdbc/mysqlxads</em>.</li>
</ol>



<p>The transaction configuration element is something like the following:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;connectionmanager&gt;</span>
  <span class="code-tag">&lt;xa-transaction&gt;</span>
     <span class="code-tag">&lt;transaction-caching/&gt;</span>
  <span class="code-tag">&lt;/xa-transaction&gt;</span>
  ...
<span class="code-tag">&lt;/connectionmanager&gt;</span>
</pre>
</div></div>

<p>And for local transaction:</p>
<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;connectionmanager&gt;</span>
   <span class="code-tag">&lt;local-transaction/&gt;</span>
   ...
<span class="code-tag">&lt;/connectionmanager&gt;</span>
</pre>
</div></div>
    </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/GMOxDOC30/Configuring+a+MySQL+datasource">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=20645327&revisedVersion=2&originalVersion=1">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Configuring+a+MySQL+datasource?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message