<?xml version="1.0" encoding="utf-8"?>

<!-- EngineVersion = Java version -->
<ApiConfig Name="Apache Flink"
           Slug="apache-flink-connector"
           Type="JDBC"
           Category="big-data"
           Id="8E6683BD-35C5-558D-967B-D34CEFF9E3BD"
           Version="1"
           EngineVersion="11"
           Desc="Query Apache Flink SQL Gateway with 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-flink-connector.png"
           HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/">

    <VersionHistory>
      <Change Ver="1" Date="2026-09-15" Type="New">Initial JDBC Bridge catalog version. Hands-free JAR download. Auth Notes and SQL examples for ODBC apps.</Change>
    </VersionHistory>
    <Template>
        <Param Name="DriverDownloadPageLink"
               Value="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/" />
        <Param Name="MvnRepositoryDriverDownloadLink"
               Value="https://mvnrepository.com/artifact/org.apache.flink/flink-sql-jdbc-driver-bundle" />
        <Param Name="DriverDownloadLinks"
               Hidden="True"
               Value="flink-sql-jdbc-driver-bundle-1.19.3.jar=https://repo1.maven.org/maven2/org/apache/flink/flink-sql-jdbc-driver-bundle/1.19.3/flink-sql-jdbc-driver-bundle-1.19.3.jar" />
    </Template>

    <Auths>
        <Auth Name="Default"
              Label="Default"
              ConnStr="jdbc:flink://[$HostName$]:[$Port$]"
              HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.apache.flink.table.jdbc.FlinkDriver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.apache.flink.table.jdbc.FlinkDriver)." HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\flink-sql-jdbc-driver-bundle-1.19.3.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/" />
                <Param Name="Port" Label="TCP port" Required="True" Value="8083" Desc="JDBC port (e.g. 8083)." HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Usually unused. The SQL Gateway ignores user name unless your distribution documents otherwise." HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Usually unused. Leave empty unless the gateway is configured for basic auth." HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/" />
            </Params>
            <Notes>
                <![CDATA[<p>Apache Flink SQL Gateway JDBC from Power BI, SQL Server Linked Server via ZappySys Data Gateway, Crystal Reports, SSRS, Azure Data Factory, and other ODBC tools. Match the bundle to the gateway major version. This pin is <code>1.19.3</code> (Java 11 gateways).</p>
<ol>
  <li>Start a Flink SQL Gateway REST endpoint (default port <code>8083</code>) bound to your Flink cluster.</li>
  <li>The gateway currently ignores user name and password; leave them empty unless your distribution documents otherwise.</li>
  <li>JDBC against the gateway is for <strong>batch</strong> queries. Do not expect interactive streaming CHANGELOG results in Power BI or Linked Server.</li>
  <li>After Finish, replace the host (e.g. MyHostName) (and port if the gateway is not on 8083).</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://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <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 TABLES]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-rows" Label="Select rows" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <Desc><![CDATA[<p>Returns rows from <code>MyTable</code>. Replace the identifier with your catalog object. Works in Excel, SSRS, and Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM MyTable]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="filter-rows" Label="Filter with WHERE" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <Desc><![CDATA[<p>Returns matching rows from <code>MyTable</code>. Swap the column and literal for your schema.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM MyTable
WHERE id = 1]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="join-tables" Label="Join tables" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <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 MyTable 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://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <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 MyTable
GROUP BY status]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="having" Label="Filter groups with HAVING" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <Desc><![CDATA[<p>Keeps groups whose count is at least 10.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM MyTable
GROUP BY status
HAVING COUNT(*) >= 10]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="order-limit" Label="Order and limit" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <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 MyTable
ORDER BY id
LIMIT 100]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="count-all" Label="Count rows" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <Desc><![CDATA[<p>Returns the number of rows in <code>MyTable</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT COUNT(*) AS row_count FROM MyTable]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="case-expr" Label="CASE expression" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <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 MyTable]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-list" Label="Select specific columns" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sql/queries/overview/">
            <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 MyTable]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="show-catalogs" Label="Show catalogs" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/">
            <Desc><![CDATA[<p>Lists Flink catalogs visible to this gateway session.</p>]]></Desc>
            <Code>
                <![CDATA[SHOW CATALOGS]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="show-databases" Label="Show databases" HelpLink="https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/jdbcdriver/">
            <Desc><![CDATA[<p>Lists databases in the current catalog.</p>]]></Desc>
            <Code>
                <![CDATA[SHOW DATABASES]]>
            </Code>
        </Example>
    </Examples>
</ApiConfig>
