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.