Revered Monks,

I'm looking for working code that shows how to DBI connect to a H2 database.

I have found a few references that claim that the Ppstgres DBD driver (DBD::Pg) can be used for this purpose, but all my attempts to use a H2 database file name with that driver failed.

I believe I need to start the H2 server, and somehow configure it to listen for Postgres protocol on a TCP port, then use the DBD:Pg driver to connect to it .. but I could not figure out the necessary parameters to start the H2 engine to listen for PG protocol.

I would appreciate either an explanation of how this is supposed to work, or known working syntax on both starting H2 appropriately, if necessary, and the connection string.

Peace and seasonal thanks to all.

        "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams


In reply to H2 database connect in perl by NetWallah

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.