Not really a question. Well, I did ask this question around 3 or so years ago, and I was finally able to figure it out - how to connect to perl with JDBC. One challenge I found was that the documenetation for modern databases was very sparse. I'm including directions here- in case any one runs into this problem.

Perl + JDBC + Trino End-to-End Example 1. Prerequisites Strawberry Perl with DBI and DBD::JDBC modules installed. Java Proxy JAR (from DBD::JDBC) running: java -jar jdbc_bridge.jar -port 12345 Trino JDBC Driver (trino-jdbc-*.jar) in your CLASSPATH. 2. Certificate Setup (Optional SSL) If your Trino instance requires a trusted connection: Convert your .crt file to .jks (Java KeyStore): keytool -import -trustcacerts -alias trino -file your_cert.crt -keystore truststore.jks -storepass changeit Then use the truststore.jks with your Java command if needed: java -Djavax.net.ssl.trustStore=truststore.jks -Djavax.net.ssl.trustStorePassword=changeit -jar jdbc_bridge.jar -port 12345 3. Perl Script: trino_connect.pl

use strict; use warnings; use DBI; # -- Your credentials my $user = "svc-ndevfcollect"; my $password = "yourPasswordHere!"; # Use secure storage in productio +n # -- JDBC URL to Trino (443 confirmed) my $url = "jdbc:trino://query.comcast.com:443?SSL=true&catalog=dx"; # -- JDBC bridge connection (localhost to Java proxy) my $dsn = "dbi:JDBC:hostname=localhost;port=12345;url=$url"; # -- Optional: Print connection hash for debugging my %conn_attrs = ( RaiseError => 1, jdbc_user => $user, jdbc_password => $password, jdbc_catalog => "dx", # Change as needed ); use Data::Dumper; print Dumper(\%conn_attrs); # -- Connect to Trino my $dbh = DBI->connect($dsn, undef, undef, \%conn_attrs) or die "Failed to connect: $DBI::errstr"; print "Connected successfully!\n"; # -- Run sample query my $sth = $dbh->prepare("SELECT current_user"); $sth->execute(); while (my @row = $sth->fetchrow_array) { print "User: $row[0]\n"; } $sth->finish(); $dbh->disconnect();
4. Launch Instructions Run your Java proxy: java -jar jdbc_bridge.jar -port 12345 Run the Perl script: perl trino_connect.pl 5. Common Issues Error Fix Authentication failed: Unauthorized Confirm user/pass, and that Trino allows password auth. unexpected end of stream Port/firewall/VPN issues. Verify port 443 is reachable. Connection argument is not a valid property Use hashref for properties, not in DSN string. SSL=true not working Confirm the Java bridge trusts Trino’s cert. Use truststore.jks if needed.


In reply to Perl JDBC Trino by mallett76

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.