<?xml version="1.0" encoding="utf-8"?>

<!-- EngineVersion = Java version -->
<ApiConfig Name="Apache Phoenix"
           Slug="apache-phoenix-connector"
           Type="JDBC"
           Category="database"
           Id="C9755429-45C1-5214-B40F-62A73C9AFE81"
           Version="1"
           EngineVersion="8"
           Desc="SQL on HBase with Apache Phoenix JDBC from Power BI, SQL Server Linked Server via ZappySys Data Gateway, Crystal Reports, SSRS, Azure Data Factory, and other ODBC tools -- almost no coding required."
           Logo="https://cdn.zappysys.com/api/Images/logos/apache-phoenix-connector.png"
           HelpLink="https://phoenix.apache.org/installation.html">

    <VersionHistory>
      <Change Ver="1" Date="2026-09-14" Type="New">Initial JDBC Bridge catalog version. Hands-free Maven JAR download. Auth Notes and SQL examples for ODBC apps.</Change>
    </VersionHistory>
    <Template>
        <Param Name="DriverDownloadPageLink"
               Value="https://phoenix.apache.org/download.html" />
        <Param Name="MvnRepositoryDriverDownloadLink"
               Value="https://mvnrepository.com/artifact/org.apache.phoenix/phoenix-client-embedded-hbase-2.5" />
        <Param Name="DriverDownloadLinks"
               Hidden="True"
               Value="phoenix-client-embedded-hbase-2.5-5.3.1.jar=https://repo1.maven.org/maven2/org/apache/phoenix/phoenix-client-embedded-hbase-2.5/5.3.1/phoenix-client-embedded-hbase-2.5-5.3.1.jar" />
    </Template>

    <Auths>
        <Auth Name="ZooKeeper"
              Label="ZooKeeper (thick client)"
              ConnStr="jdbc:phoenix+zk:[$HostName$]:[$Port$]:/hbase"
              HelpLink="https://phoenix.apache.org/installation.html">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.apache.phoenix.jdbc.PhoenixDriver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.apache.phoenix.jdbc.PhoenixDriver)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\phoenix-client-embedded-hbase-2.5-5.3.1.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="Port" Label="TCP port" Required="True" Value="2181" Desc="JDBC port (e.g. 2181)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://phoenix.apache.org/installation.html" />
            </Params>
            <Notes>
                <![CDATA[<p>Apache Phoenix JDBC from Power BI, SQL Server Linked Server via ZappySys Data Gateway, Crystal Reports, SSRS, Azure Data Factory, and other ODBC tools.</p>
<ol>
  <li>Get the ZooKeeper quorum and HBase znode (often <code>/hbase</code>).</li><li>This thick client JAR talks to ZK + HBase. Network access to ZK and region servers is required from the DSN host (gateway or Power BI on-prem).</li><li>Create a Phoenix user if Kerberos/HBase auth is enabled; otherwise leave user/password empty.</li>
  <li>Finish the wizard. Then click <strong>Test Connection</strong> on the DSN Main UI (the wizard does not run Test Connection).</li><li>Done. You can query from C#, Python, PowerShell, and ODBC apps.</li>
</ol>]]>
            </Notes>
        </Auth>
        <Auth Name="Thin"
              Label="Query Server (thin)"
              ConnStr="jdbc:phoenix:thin:url=http://[$HostName$]:[$Port$]"
              HelpLink="https://phoenix.apache.org/installation.html">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.apache.phoenix.jdbc.PhoenixDriver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.apache.phoenix.jdbc.PhoenixDriver)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\phoenix-client-embedded-hbase-2.5-5.3.1.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="Port" Label="TCP port" Required="True" Value="2181" Desc="JDBC port (e.g. 2181)." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://phoenix.apache.org/installation.html" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://phoenix.apache.org/installation.html" />
            </Params>
            <Notes>
                <![CDATA[<p>Apache Phoenix Query Server JDBC from Power BI, SQL Server Linked Server via ZappySys Data Gateway, Crystal Reports, SSRS, Azure Data Factory, and other ODBC tools.</p>
<ol>
  <li>Start or locate Phoenix Query Server (default port <code>8765</code>).</li><li>Replace host in the JDBC URL. User/password only if the server requires them.</li>
  <li>Finish the wizard. Then click <strong>Test Connection</strong> on the DSN Main UI (the wizard does not run Test Connection).</li><li>Done. You can query from C#, Python, PowerShell, and ODBC apps.</li>
</ol>]]>
            </Notes>
        </Auth>
    </Auths>

    <Examples>
        <Example Default="True" Group="ODBC" Slug="list-tables" Label="List tables" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Lists tables available to this connection. Use this in Power BI or a SQL Server Linked Server to confirm the catalog before building reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT DISTINCT TABLE_NAME FROM SYSTEM.CATALOG WHERE TABLE_TYPE = 'u' ORDER BY TABLE_NAME]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-rows" Label="Select rows" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Returns rows from <code>MY_TABLE</code>. Replace the identifier with your catalog object. Works in Excel, SSRS, and Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM MY_TABLE]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="filter-rows" Label="Filter with WHERE" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Returns matching rows from <code>MY_TABLE</code>. Swap the column and literal for your schema.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM MY_TABLE
WHERE id = 1]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="join-tables" Label="Join tables" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Joins two tables on a key. Use in Azure Data Factory or SSIS when you need a combined extract.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT a.id, a.name, b.amount
FROM MY_TABLE AS a
JOIN my_other_table AS b ON a.id = b.parent_id]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="group-by" Label="Aggregate with GROUP BY" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Counts rows per group. Typical Power BI import pattern before a visual.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM MY_TABLE
GROUP BY status]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="having" Label="Filter groups with HAVING" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Keeps groups whose count is at least 10.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM MY_TABLE
GROUP BY status
HAVING COUNT(*) >= 10]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="order-limit" Label="Order and limit" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Returns the first 100 rows ordered by a column. Useful for preview in Excel or Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM MY_TABLE
ORDER BY id
LIMIT 100]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="count-all" Label="Count rows" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Returns the number of rows in <code>MY_TABLE</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT COUNT(*) AS row_count FROM MY_TABLE]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="case-expr" Label="CASE expression" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Maps a column to labels with <code>CASE</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT id,
       CASE WHEN status = 'A' THEN 'Active' ELSE 'Other' END AS status_label
FROM MY_TABLE]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-list" Label="Select specific columns" HelpLink="https://phoenix.apache.org/language/index.html">
            <Desc><![CDATA[<p>Returns a column list instead of star. Prefer this in Linked Server views.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT id, name, status
FROM MY_TABLE]]>
            </Code>
        </Example>
    </Examples>
</ApiConfig>
