<?xml version="1.0" encoding="utf-8"?>

<!-- EngineVersion = Java version -->
<ApiConfig Name="H2"
           Slug="h2-connector"
           Type="JDBC"
           Category="database"
           Id="C7F031A5-9404-5267-9A80-D65B05722BFA"
           Version="1"
           EngineVersion="8"
           Desc="Read and write H2 embedded or TCP databases 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/h2-connector.png"
           HelpLink="https://h2database.com/html/features.html#database_url">

    <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://h2database.com/html/download.html" />
        <Param Name="MvnRepositoryDriverDownloadLink"
               Value="https://mvnrepository.com/artifact/com.h2database/h2" />
        <Param Name="DriverDownloadLinks"
               Hidden="True"
               Value="h2-2.3.232.jar=https://repo1.maven.org/maven2/com/h2database/h2/2.3.232/h2-2.3.232.jar" />
    </Template>

    <Auths>
        <Auth Name="Memory"
              Label="In-memory"
              ConnStr="jdbc:h2:mem:[$Database$]"
              HelpLink="https://h2database.com/html/features.html#database_url">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.h2.Driver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.h2.Driver)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\h2-2.3.232.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="Database" Label="Database name" Required="False" Value="MyDatabase" Desc="Database, schema, or catalog name (e.g. MyDatabase)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://h2database.com/html/features.html#database_url" />
            </Params>
            <Notes>
                <![CDATA[<p>H2 in-memory 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>No server to install. Data lives in the Java process for this DSN and is gone when the connection closes unless you add <code>DB_CLOSE_DELAY=-1</code>.</li><li>Optional user/password: default lab user is often <code>sa</code> with empty password.</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="File"
              Label="Local file"
              ConnStr="jdbc:h2:file:{DownloadFolder}\h2db"
              HelpLink="https://h2database.com/html/features.html#database_url">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.h2.Driver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.h2.Driver)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\h2-2.3.232.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://h2database.com/html/features.html#database_url" />
            </Params>
            <Notes>
                <![CDATA[<p>H2 file 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>The wizard downloads the H2 JAR into <code>{DownloadFolder}</code>. The database file is created next to it as <code>h2db.mv.db</code>.</li><li>Point the URL at another folder after Finish if you already have an H2 file.</li><li>Optional user/password (<code>sa</code> / empty is common for local files).</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="Tcp"
              Label="TCP server"
              ConnStr="jdbc:h2:tcp://[$HostName$]:[$Port$]/~/[$Database$]"
              HelpLink="https://h2database.com/html/features.html#database_url">
            <Params>
                <Param Name="DriverClass" Label="Driver class" Required="False" Value="org.h2.Driver" Desc="Optional. Leave blank to auto-detect from the JAR unless SPI is ambiguous (e.g. org.h2.Driver)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="DriverFilePaths" Editor="FileOpen" Label="JDBC driver file(s)" Required="True" Value="{DownloadFolder}\h2-2.3.232.jar" Desc="Filled by the wizard after download. Separate multiple JARs with a semicolon (e.g. C:\ZappySys\Jdbc\MyConnector\driver.jar)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="HostName" Label="Host" Required="True" Value="MyHostName" Desc="JDBC host name or IP (e.g. MyHostName)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="Port" Label="TCP port" Required="True" Value="9092" Desc="JDBC port (e.g. 9092)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="Database" Label="Database name" Required="False" Value="MyDatabase" Desc="Database, schema, or catalog name (e.g. MyDatabase)." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="UserName" Label="User name" Required="False" Desc="Database user. Leave empty if the server allows anonymous JDBC." HelpLink="https://h2database.com/html/features.html#database_url" />
                <Param Name="Password" Label="Password" Required="False" Secret="True" Desc="Database password. Leave empty if no password is required." HelpLink="https://h2database.com/html/features.html#database_url" />
            </Params>
            <Notes>
                <![CDATA[<p>H2 TCP 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 the H2 server (default TCP <code>9092</code>) or connect to an existing one.</li><li>Replace the host (e.g. MyHostName), port (e.g. 9092), and database path. Fill user and password from that server.</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://h2database.com/html/commands.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 TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'PUBLIC' ORDER BY TABLE_NAME]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-rows" Label="Select rows" HelpLink="https://h2database.com/html/commands.html">
            <Desc><![CDATA[<p>Returns rows from <code>PUBLIC.MY_TABLE</code>. Replace the identifier with your catalog object. Works in Excel, SSRS, and Crystal Reports.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM PUBLIC.MY_TABLE]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="filter-rows" Label="Filter with WHERE" HelpLink="https://h2database.com/html/commands.html">
            <Desc><![CDATA[<p>Returns matching rows from <code>PUBLIC.MY_TABLE</code>. Swap the column and literal for your schema.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT * FROM PUBLIC.MY_TABLE
WHERE id = 1]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="join-tables" Label="Join tables" HelpLink="https://h2database.com/html/commands.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 PUBLIC.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://h2database.com/html/commands.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 PUBLIC.MY_TABLE
GROUP BY status]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="having" Label="Filter groups with HAVING" HelpLink="https://h2database.com/html/commands.html">
            <Desc><![CDATA[<p>Keeps groups whose count is at least 10.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT status, COUNT(*) AS row_count
FROM PUBLIC.MY_TABLE
GROUP BY status
HAVING COUNT(*) >= 10]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="order-limit" Label="Order and limit" HelpLink="https://h2database.com/html/commands.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 PUBLIC.MY_TABLE
ORDER BY id
LIMIT 100]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="count-all" Label="Count rows" HelpLink="https://h2database.com/html/commands.html">
            <Desc><![CDATA[<p>Returns the number of rows in <code>PUBLIC.MY_TABLE</code>.</p>]]></Desc>
            <Code>
                <![CDATA[SELECT COUNT(*) AS row_count FROM PUBLIC.MY_TABLE]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="case-expr" Label="CASE expression" HelpLink="https://h2database.com/html/commands.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 PUBLIC.MY_TABLE]]>
            </Code>
        </Example>

        <Example Group="ODBC" Slug="select-list" Label="Select specific columns" HelpLink="https://h2database.com/html/commands.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 PUBLIC.MY_TABLE]]>
            </Code>
        </Example>
    </Examples>
</ApiConfig>
