<html>
<head>
<base href="https://docs.jboss.org/author">
<link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&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/Phoenix+Data+Sources">Phoenix Data Sources</a></h2>
<h4>Page <b>edited</b> by <a href="https://docs.jboss.org/author/display/~kylin">Kylin Soong</a>
</h4>
<br/>
<h4>Changes (2)</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" >The second step is executing the DDL to map Phoenix table to an existing HBase table, the DDL can either be executed via [Phoenix Command Line|http://phoenix.apache.org/download.html], or executed by JDBC. <br> <br></td></tr>
<tr><td class="diff-changed-lines" >The Following is a example for mapping an existing HBase <span class="diff-added-words"style="background-color: #dfd;">table, assume the Customer</span> table <span class="diff-added-words"style="background-color: #dfd;">is existing in HBase, it looks as below figure</span> <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;"> <br> <br>Test <br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<h1><a name="PhoenixDataSources-PhoenixDataSources"></a>Phoenix Data Sources</h1>
<p>Primary purpose of this article including:</p>
<ul>
        <li>Configuring a Phoenix data source in JBoss/WildFly Container(later than JBoss AS 7)</li>
</ul>
<ul>
        <li>Mapping Phoenix table to an existing HBase table</li>
</ul>
<ul>
        <li>Creaing Phoenix table for creating a new HBase table</li>
</ul>
<h1><a name="PhoenixDataSources-ConfiguringaPhoenixdatasourceinJBoss%2FWildFly%28laterthanJBossAS7%29"></a>Configuring a Phoenix data source in JBoss/WildFly (later than JBoss AS 7)</h1>
<p>Configuring a Phoenix data source is nearly identical configuring a <a href="/author/display/TEIID/JDBC+Data+Sources" title="JDBC Data Sources">JDBC Data Sources</a>, first step is deploying the Phoenix driver jar, the following command using the CLI to deploy Phoenix driver</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;">
deploy /path/to/phoenix-[version]-client.jar
</pre>
</div></div>
<p>The Driver jar can be download from <a href="http://phoenix.apache.org/" class="external-link" rel="nofollow">phoenix document.</a></p>
<p>The second steps is creating the Data Source base on above deployed driver, also like creating <a href="/author/display/TEIID/JDBC+Data+Sources" title="JDBC Data Sources">JDBC Data Source</a>, execute the following CLI command:</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=phoenixDS:add(jndi-name=java:/phoenixDS, driver-name=phoenix-[version].jar, driver-class=org.apache.phoenix.jdbc.PhoenixDriver, connection-url=jdbc:phoenix:{zookeeper quorum server},user-name={user}, password={password})
</pre>
</div></div>
<p>Please make sure the URL, Driver are configured correctly:</p>
<ul>
        <li>jndi-name - The JNDI name need to match the JNDI name you used in VDB</li>
</ul>
<ul>
        <li>driver-name - The Driver name need to match the driver you deployed in above steps</li>
</ul>
<ul>
        <li>driver-class - The Driver Class, the value should be org.apache.phoenix.jdbc.PhoenixDriver</li>
</ul>
<ul>
        <li>connection-url - The URL need to match the HBase zookeeper quorum server, the format like jdbc:phoenix [ :<zookeeper quorum> [ :<port number> ] [ :<root node> ] ], 'jdbc:phoenix:127.0.0.1:2181' is a example</li>
</ul>
<ul>
        <li>user-name/password - The user credentials for Phoenix Connection</li>
</ul>
<h1><a name="PhoenixDataSources-MappingPhoenixtabletoanexistingHBasetable"></a>Mapping Phoenix table to an existing HBase table</h1>
<p>Mapping Phoenix table to an existing HBase table has 2 steps, the first step is installing phoenix-[version]-server.jar to the classpath of every HBase region server,an easy way to do this is to copy it into the HBase lib, more details please refer to <a href="http://phoenix.apache.org/download.html" class="external-link" rel="nofollow">phoenix document</a>.</p>
<p>The second step is executing the DDL to map Phoenix table to an existing HBase table, the DDL can either be executed via <a href="http://phoenix.apache.org/download.html" class="external-link" rel="nofollow">Phoenix Command Line</a>, or executed by JDBC.</p>
<p>The Following is a example for mapping an existing HBase table, assume the Customer table is existing in HBase, it looks as below figure</p>
<p>Test</p>
</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/Phoenix+Data+Sources">View Online</a>
|
<a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=88866974&revisedVersion=4&originalVersion=3">View Changes</a>
|
<a href="https://docs.jboss.org/author/display/TEIID/Phoenix+Data+Sources?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>