<?xml version="1.0" encoding="utf-8"?>

<!-- EngineVersion = Java version -->
<ApiConfig Name="Starburst"
           Slug="starburst-connector"
           Type="JDBC"
           Category="big-data"
           Id="b3f5c8d4-7a6e-4c9e-9f3b-2d8a4e6d5f1a"
           Version="2"
           EngineVersion="11"
           Desc="Query Starburst catalogs 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/starburst-connector.png"
           HelpLink="https://community.zappysys.com/tag/trino">

    <VersionHistory>
      <Change Ver="2" Date="2026-09-15" Type="Modified">Auth Notes (numbered steps), documented params, Maven DriverDownloadLinks, extra SQL examples for ODBC apps.</Change>
      <Change Ver="1" Date="2025-04-29" Type="New">Initial version.</Change>
    </VersionHistory>
    <Template>
        <Param Name="DriverDownloadPageLink"
               Value="https://docs.starburst.io/latest/client/jdbc.html" />
        <Param Name="MvnRepositoryDriverDownloadLink"
               Value="https://mvnrepository.com/artifact/io.trino/trino-jdbc" />
        <Param Name="DriverDownloadLinks"
               Hidden="True"
               Value="trino-jdbc-476.jar=https://repo1.maven.org/maven2/io/trino/trino-jdbc/476/trino-jdbc-476.jar" />
    </Template>
    <Auths>
        <Auth Name="NonSsl"
              Label="Non-SSL connection"
              ConnStr="jdbc:trino://[$HostName$]:[$Port$]"
              HelpLink="https://docs.starburst.io/latest/client/jdbc.html">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="io.trino.jdbc.TrinoDriver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. io.trino.jdbc.TrinoDriver)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\trino-jdbc-476.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="Port" Label="TCP port" Required="True" Value="443" Desc="JDBC port (e.g. 443)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if none." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
            </Params>
            <Notes>
                <![CDATA[<p>Starburst 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 coordinator host and HTTP port (often <code>8080</code> for lab, <code>443</code> for Cloud TLS).</li><li>Create an application user if the cluster requires a password. Some labs allow any user with an empty password.</li><li>After Finish, set catalog/schema on the DSN Main UI or qualify tables as <code>tpch.sf1.orders</code>.</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="Ssl"
              Label="SSL connection"
              ConnStr="jdbc:trino://[$HostName$]:[$Port$]?SSL=[$Ssl$]"
              HelpLink="https://docs.starburst.io/latest/client/jdbc.html">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="io.trino.jdbc.TrinoDriver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. io.trino.jdbc.TrinoDriver)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\trino-jdbc-476.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="Port" Label="TCP port" Required="True" Value="443" Desc="JDBC port (e.g. 443)." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="Ssl" Label="SSL" Required="False" Options="Notset=;Yes=true;No=false" Value="true" Desc="SSL flag for this JDBC URL (e.g. Yes from the dropdown)." HelpLink="https://docs.starburst.io/latest/client/jdbc.html" />
                <Param Name="UserName" Label="User name" Required="True" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
                <Param Name="Password" Label="Password" Required="True" Secret="True" Desc="Database password. Leave empty if none." HelpLink="https://trino.io/docs/current/client/jdbc.html" />
            </Params>
            <Notes>
                <![CDATA[<p>Starburst with TLS from Power BI, SQL Server Linked Server via ZappySys Data Gateway, Crystal Reports, SSRS, Azure Data Factory, and other ODBC tools.</p>
<ol>
<li>Same as Non-SSL Auth. Use port 443 (or your TLS port) and <code>SSL=true</code>.</li><li>Fill user and password from the coordinator or Starburst Galaxy/Galaxy-like console.</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 Group="ODBC" Slug="list-tables" Label="List tables" HelpLink="https://trino.io/docs/current/sql/select.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[SHOW TABLES FROM tpch.sf1]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-rows" Label="Select rows" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Returns rows from <code>tpch.sf1.orders</code>. Replace the identifier with your catalog object. Works in Excel, SSRS, and Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM tpch.sf1.orders]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="filter-rows" Label="Filter with WHERE" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Returns matching rows from <code>tpch.sf1.orders</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM tpch.sf1.orders
WHERE id = 1]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="join-tables" Label="Join tables" HelpLink="https://trino.io/docs/current/sql/select.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 tpch.sf1.orders 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://trino.io/docs/current/sql/select.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 tpch.sf1.orders
GROUP BY status]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="order-limit" Label="Order and limit" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Returns the first 100 rows. Useful for preview in Excel or Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM tpch.sf1.orders
ORDER BY orderkey
LIMIT 100]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="count-all" Label="Count rows" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Returns the number of rows in <code>tpch.sf1.orders</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT COUNT(*) AS row_count FROM tpch.sf1.orders]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="case-expr" Label="CASE expression" HelpLink="https://trino.io/docs/current/sql/select.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 tpch.sf1.orders]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-list" Label="Select specific columns" HelpLink="https://trino.io/docs/current/sql/select.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 tpch.sf1.orders]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="having" Label="Filter groups with HAVING" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Keeps groups whose count is at least 1.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM tpch.sf1.orders
GROUP BY status
HAVING COUNT(*) >= 1]]>
            </Code>
        </Example>

        <Example Default="True" Group="ODBC" Slug="read-orders" Label="Read orders" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Reads all records from <code>tpch.sf1.orders</code>. Sample catalog often shipped with Trino/Starburst labs. Use in Power BI to confirm the catalog.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM tpch.sf1.orders]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="read-open-orders" Label="Read open orders" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Reads orders with status <code>O</code>. Demonstrates WHERE for Excel or SSRS filters.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT *
FROM tpch.sf1.orders
WHERE orderstatus = 'O']]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="count-orders-grouped-by-priority" Label="Count orders grouped by priority" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Counts orders per priority. Typical Power BI import before a visual.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT orderpriority, COUNT(*) as count
FROM tpch.sf1.orders
GROUP BY orderpriority
ORDER BY orderpriority]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="read-customer-orders" Label="Read customer orders" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Joins orders to customer. Use in Azure Data Factory or a Linked Server view.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT c.name, o.orderkey, totalprice
FROM tpch.sf1.orders as o
JOIN tpch.sf1.customer as c on c.custkey = o.custkey]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="calculate-total-order-price-per-customer" Label="Calculate total order price per customer" HelpLink="https://trino.io/docs/current/sql/select.html">
            <Desc><![CDATA[<p>Sums order price per customer.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT c.name, SUM(totalprice) as totalprice
FROM tpch.sf1.orders as o
JOIN tpch.sf1.customer as c on c.custkey = o.custkey
GROUP BY c.name
ORDER BY c.name]]>
            </Code>
        </Example>
    </Examples>
</ApiConfig>
