<?xml version="1.0" encoding="utf-8"?>

<!-- EngineVersion = Java version -->
<ApiConfig Name="Apache Drill"
           Slug="apache-drill-connector"
           Type="JDBC"
           Category="big-data"
           Id="E54D6C45-5262-5A17-99B6-026814E706F1"
           Version="1"
           EngineVersion="8"
           Desc="Query files, Hive, and S3 with Apache Drill SQL 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-drill-connector.png"
           HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/">

    <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://drill.apache.org/docs/using-the-jdbc-driver/" />
        <Param Name="MvnRepositoryDriverDownloadLink"
               Value="https://mvnrepository.com/artifact/org.apache.drill.exec/drill-jdbc-all" />
        <Param Name="DriverDownloadLinks"
               Hidden="True"
               Value="drill-jdbc-all-1.22.0.jar=https://repo1.maven.org/maven2/org/apache/drill/exec/drill-jdbc-all/1.22.0/drill-jdbc-all-1.22.0.jar" />
    </Template>

    <Auths>
        <Auth Name="Drillbit"
              Label="Drillbit"
              ConnStr="jdbc:drill:drillbit=[$HostName$]:[$Port$]"
              HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.apache.drill.jdbc.Driver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.apache.drill.jdbc.Driver)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\drill-jdbc-all-1.22.0.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="Port" Label="TCP port" Required="True" Value="31010" Desc="JDBC port (e.g. 31010)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
            </Params>
            <Notes>
                <![CDATA[<p>Apache Drill 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>Note the Drillbit host and JDBC port (default <code>31010</code>).</li><li>Create a Drill user if authentication is enabled, or leave user/password empty for anonymous clusters.</li><li>Replace <code>hostname</code> in the JDBC URL. Enable SSL only if your cluster requires it (see the Drill JDBC docs).</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="ZooKeeper"
              Label="ZooKeeper"
              ConnStr="jdbc:drill:zk=[$HostName$]:[$Port$]/drill/drillbits1"
              HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.apache.drill.jdbc.Driver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.apache.drill.jdbc.Driver)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\drill-jdbc-all-1.22.0.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="Port" Label="TCP port" Required="True" Value="31010" Desc="JDBC port (e.g. 31010)." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://drill.apache.org/docs/using-the-jdbc-driver/" />
            </Params>
            <Notes>
                <![CDATA[<p>Apache Drill (ZooKeeper) 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 Drill cluster path from your ops team (often <code>/drill/drillbits1</code>).</li><li>Replace host and path in the JDBC URL. User/password only if Drill auth is on.</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://drill.apache.org/docs/select/">
            <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[SHOW DATABASES]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-rows" Label="Select rows" HelpLink="https://drill.apache.org/docs/select/">
            <Desc><![CDATA[<p>Returns rows from <code>cp.`employee.json`</code>. Replace the identifier with your catalog object. Works in Excel, SSRS, and Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM cp.`employee.json`]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="filter-rows" Label="Filter with WHERE" HelpLink="https://drill.apache.org/docs/select/">
            <Desc><![CDATA[<p>Returns matching rows from <code>cp.`employee.json`</code>. Swap the column and literal for your schema.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM cp.`employee.json`
WHERE id = 1]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="join-tables" Label="Join tables" HelpLink="https://drill.apache.org/docs/select/">
            <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 cp.`employee.json` 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://drill.apache.org/docs/select/">
            <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 cp.`employee.json`
GROUP BY status]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="having" Label="Filter groups with HAVING" HelpLink="https://drill.apache.org/docs/select/">
            <Desc><![CDATA[<p>Keeps groups whose count is at least 10.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM cp.`employee.json`
GROUP BY status
HAVING COUNT(*) >= 10]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="order-limit" Label="Order and limit" HelpLink="https://drill.apache.org/docs/select/">
            <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 cp.`employee.json`
ORDER BY id
LIMIT 100]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="count-all" Label="Count rows" HelpLink="https://drill.apache.org/docs/select/">
            <Desc><![CDATA[<p>Returns the number of rows in <code>cp.`employee.json`</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT COUNT(*) AS row_count FROM cp.`employee.json`]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="case-expr" Label="CASE expression" HelpLink="https://drill.apache.org/docs/select/">
            <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 cp.`employee.json`]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-list" Label="Select specific columns" HelpLink="https://drill.apache.org/docs/select/">
            <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 cp.`employee.json`]]>
            </Code>
        </Example>
    </Examples>
</ApiConfig>
