<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/JDBC+Data+Sources">JDBC Data Sources</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <br/>
                         <h4>Changes (7)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{color:#333333}The following is an example highlighting configuring an Oracle data source. The process is nearly identical regardless of the database vendor. Typically the JDBC jar and the configuration like connection URL and user credentials change.{color} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >{color:#333333}There are configuration templates for all the data sources in the &quot;&lt;jboss-install&gt;/docs/teiid/datasources&quot; directory. A complete description how a data source can be added into JBoss AS7.x is also <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">described&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}here{color}|http://community.jboss.org/docs/DOC-16657]{color}{color:#333333}.</span> <span class="diff-added-words"style="background-color: #dfd;">described&amp;nbsp;[here|http://community.jboss.org/docs/DOC-16657].</span> The below we present two different ways to create a <span class="diff-changed-words">datasource.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. {color:#000000}{*}Deploying the JDBC Jar File{*}{color} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >{color:#333333}First step in configuring the data source is deploying the required JDBC jar file. For example, if you are trying to create a Oracle data source, first you need to deploy the &quot;ojdbc6.jar&quot; file first. Execute following command <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">using&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}CLI{color}|https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-RunningtheCLI]{color}{color:#333333}&amp;nbsp;once</span> <span class="diff-added-words"style="background-color: #dfd;">using&amp;nbsp;[CLI|https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-RunningtheCLI]&amp;nbsp;once</span> you connected to the <span class="diff-changed-words">Server.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br>   deploy /path/to/ojdbc6.jar <br>{code} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{tip:title=Developer&#39;s Tip} <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}If</span> <span class="diff-added-words"style="background-color: #dfd;">{tip:title=Developer&#39;s Tip}If</span> the JBoss AS 7.x is running in standalone mode, you can also manually copy this &#39;ojdbc6.jar&quot; to the &quot;&lt;jboss-install&gt;/standalone/deployments&quot; directory, to automatically deploy without using the CLI <span class="diff-changed-words">tool.{<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">color}{</span>tip}</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h3. {color:#000000}{*}Create Data Source{*}{color} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>Now</span> that you have the Oracle JDBC driver deployed, it is time to create a data source using this driver. There are many ways to create the datasource using <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">CLI,&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}AdminShell{color}|AdminShell]{color}{color:#333333},</span> <span class="diff-added-words"style="background-color: #dfd;">CLI,&amp;nbsp;[AdminShell],</span> admin-console etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain <span class="diff-changed-words">modes.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>Execute</span> following command <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">using&amp;nbsp;{color}{color:#005e8f}[{color:#005e8f}CLI{color}|https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-RunningtheCLI]{color}{color:#333333}&amp;nbsp;once</span> <span class="diff-added-words"style="background-color: #dfd;">using&amp;nbsp;[CLI|https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-RunningtheCLI]&amp;nbsp;once</span> you connected to the Server. Make sure you provide the correct URL and user credentials and edit the JNDI name to match the JNDI name you used in <span class="diff-changed-words">VDB.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br>/subsystem=datasources/data-source=oracel-ds:add(jndi-name=java:/OracleDS, driver-name=ojdbc6.jar, connection-url=jdbc:oracle:thin:{host}:1521:orcl,user-name={user}, password={password}) <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{tip:title=Developer&#39;s Tip} <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>If</span> the JBoss AS 7.x is running in standalone mode, you can also manually edit the &quot;&lt;jboss-install&gt;/standalone/configuration/standalone-teiid.xml&quot; file and add the XML configuration defined in &quot;&lt;jboss-install&gt;/docs/teiid/datasources/oracle&quot; directory under &quot;datasources&quot; subsystem. Shutdown the server before you edit this file, and restart after the modifications are <span class="diff-changed-words">done.{<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">color}{</span>tip}</span> <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="JDBCDataSources-"></a><font color="#000000"><b>JDBC Data Sources</b></font></h1>

<p><font color="#333333">The following is an example highlighting configuring an Oracle data source. The process is nearly identical regardless of the database vendor. Typically the JDBC jar and the configuration like connection URL and user credentials change.</font></p>

<p><font color="#333333">There are configuration templates for all the data sources in the "&lt;jboss-install&gt;/docs/teiid/datasources" directory. A complete description how a data source can be added into JBoss AS7.x is also described&nbsp;<a href="http://community.jboss.org/docs/DOC-16657" class="external-link" rel="nofollow">here</a>. The below we present two different ways to create a datasource.<br/>
<br/>
h3. <font color="#000000"></font><b>Deploying the JDBC Jar File</b></font></p>

<p><font color="#333333">First step in configuring the data source is deploying the required JDBC jar file. For example, if you are trying to create a Oracle data source, first you need to deploy the "ojdbc6.jar" file first. Execute following command using&nbsp;<a href="https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-RunningtheCLI" class="external-link" rel="nofollow">CLI</a>&nbsp;once you connected to the Server.<br/>
<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;">
   deploy /path/to/ojdbc6.jar
</pre>
</div></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.x is running in standalone mode, you can also manually copy this 'ojdbc6.jar" to the "&lt;jboss-install&gt;/standalone/deployments" directory, to automatically deploy without using the CLI tool.</td></tr></table></div><br/>
<br/>
h3. <font color="#000000"></font><b>Create Data Source</b></font></p>

<p>Now that you have the Oracle JDBC driver deployed, it is time to create a data source using this driver. There are many ways to create the datasource using CLI,&nbsp;<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 following command using&nbsp;<a href="https://docs.jboss.org/author/display/AS7/Admin+Guide#AdminGuide-RunningtheCLI" class="external-link" rel="nofollow">CLI</a>&nbsp;once you connected to the Server. Make sure you provide the correct URL and user credentials and 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;">
/subsystem=datasources/data-source=oracel-ds:add(jndi-name=java:/OracleDS, driver-name=ojdbc6.jar, connection-url=jdbc:oracle:thin:{host}:1521:orcl,user-name={user}, password={password})
/subsystem=datasources/data-source=oracel-ds:enable
</pre>
</div></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.x 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 "&lt;jboss-install&gt;/docs/teiid/datasources/oracle" directory under "datasources" 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/JDBC+Data+Sources">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55476951&revisedVersion=2&originalVersion=1">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/JDBC+Data+Sources?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>