<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&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://docs.jboss.org/author/display/TEIID/MongoDB+Data+Sources">MongoDB Data Sources</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://docs.jboss.org/author/display/~rareddy">Ramesh Reddy</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="MongoDBDataSources-MongoDBDataSources"></a><b>MongoDB Data Sources</b></h1>

<p>MongoDB data sources use a Teiid specific JCA connector that is deployed into AS 7.2 (EAP 6.1 Alpha) during installation. There are many ways to create a MongoDB data source, using CLI, <a href="/author/display/TEIID/AdminShell" title="AdminShell">AdminShell</a>, admin-console, etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.</p>

<p>Execute the following command using the <a href="/author/display/AS72/Admin+Guide#AdminGuide-RunningtheCLI">CLI</a> once you connected to the Server. Make sure you provide the correct URL and user credentials. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
batch
/subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS:add(jndi-name="java:/mongoDS", class-name=org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory, enabled=true, use-java-context=true)
/subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=RemoteServerList:add(value="{host}:27017")
/subsystem=resource-adapters/resource-adapter=mongodb/connection-definitions=mongodbDS/config-properties=Database:add(value="{db-name}")
/subsystem=resource-adapters/resource-adapter=mongodb:activate
runbatch
</pre>
</div></div>

<p>All the properties that are defined on the RAR file are </p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Property Name</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
<th class='confluenceTh'>Default</th>
</tr>
<tr>
<td class='confluenceTd'>RemoteServerList</td>
<td class='confluenceTd'>A comma separated list of server locations. Each location can contain an optional port, of the format host:port</td>
</tr>
<tr>
<td class='confluenceTd'>Username</td>
<td class='confluenceTd'>Connection User's Name</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>none</td>
</tr>
<tr>
<td class='confluenceTd'>Password</td>
<td class='confluenceTd'>Connection User's password</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>none</td>
</tr>
<tr>
<td class='confluenceTd'>Database</td>
<td class='confluenceTd'>MongoDB database name</td>
<td class='confluenceTd'>true</td>
<td class='confluenceTd'>none</td>
</tr>
</tbody></table>
</div>



<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>To find out all the properties that are supported by this MongoDB Connector execute the following command in the CLI.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">/subsystem=teiid:read-rar-description(rar-name=mongodb)
</pre>
</div></div></td></tr></table></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Developer's Tip</b><br />If the JBoss AS 7.2 (EAP 6.1 Alpha) is running in standalone mode, you can also manually edit the "&lt;jboss-install&gt;/standalone/configuration/standalone-teiid.xml" file and add the XML configuration defined in <b>"&lt;jboss-install&gt;/docs/teiid/datasources/mongodb"</b> directory under "resource-adapters" subsystem. Shutdown the server before you edit this file, and restart after the modifications are done.</td></tr></table></div>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
       <a href="https://docs.jboss.org/author/display/TEIID/MongoDB+Data+Sources">View Online</a>
              |
       <a href="https://docs.jboss.org/author/display/TEIID/MongoDB+Data+Sources?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>