I believe I am getting closer. Running the below code

use strict; use warnings; use Inline Java => <<'END'; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.io.PrintWriter; public class TeradataConnectionTest { public static void testConnection(String jdbcUrl, String username, Str +ing password) { try { DriverManager.setLogWriter(new PrintWriter(System.out)); //DriverManager.registerDriver(new com.teradata.jdbc.TeraDriver()); Di +d not work //Class.forName("com.teradata.jdbc.TeraDriver"); Did not work // Class.forName("com.ncr.teradata.TeraDriver"); Did not work Connection connection = DriverManager.getConnection(jdbcUrl, username, + password); System.out.println("Connected to Teradata!"); // Perform your database operations here connection.close(); } catch (SQLException e) { // Print the stack trace or error message e.printStackTrace(); System.err.println("SQLException: " + e.getMessage()); } catch (Exception e) { // Handle other exceptions e.printStackTrace(); } } } END # Your Teradata connection details my $jdbcUrl = "jdbc:teradata://172.28.130.20/TMODE=TERA,DBS_PORT=1025, +CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW;TeraDriver=com.teradata.jdbc. +TeraDriver"; my $username = "XXXXX"; my $password = "XXXXX"; # Call the Java method to test the connection TeradataConnectionTest->testConnection($jdbcUrl, $username, $password) +;

I am receiving the following error:

DriverManager.getConnection("jdbc:teradata://172.28.130.20/TMODE=TERA, +DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW;TeraDriver=com. +teradata.jdbc.TeraDriver") registerDriver: io.trino.jdbc.TrinoDriver@2dd9625c DriverManager.initialize: jdbc.drivers = null JDBC DriverManager initialized trying io.trino.jdbc.TrinoDriver getConnection: no suitable driver found for jdbc:teradata://172.28.130 +.20/TMODE=TERA,DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW; +TeraDriver=com.teradata.jdbc.TeraDriver java.sql.SQLException: No suitable driver found for jdbc:teradata://17 +2.28.130.20/TMODE=TERA,DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMOD +E=ALLOW;TeraDriver=com.teradata.jdbc.TeraDriver at java.sql/java.sql.DriverManager.getConnection(DriverManager +.java:708) at java.sql/java.sql.DriverManager.getConnection(DriverManager +.java:230) at TeradataConnectionTest.testConnection(TeradataConnectionTes +t.java:15) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.i +nvoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at InlineJavaUserClassLink.invoke(InlineJavaUserClassLink.java +:11) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.i +nvoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.perl.inline.java.InlineJavaUserClassLoader.invoke_via_l +ink(InlineJavaUserClassLoader.java:86) at org.perl.inline.java.InlineJavaUserClassLoader.invoke(Inlin +eJavaUserClassLoader.java:131) at org.perl.inline.java.InlineJavaProtocol.CallJavaMethod(Inli +neJavaProtocol.java:283) at org.perl.inline.java.InlineJavaProtocol.Do(InlineJavaProtoc +ol.java:41) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:153) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:142) at org.perl.inline.java.InlineJavaServerThread.run(InlineJavaS +erverThread.java:51) SQLException: SQLState(08001) java.sql.SQLException: No suitable driver found for jdbc:teradata://17 +2.28.130.20/TMODE=TERA,DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMOD +E=ALLOW;TeraDriver=com.teradata.jdbc.TeraDriver at java.sql/java.sql.DriverManager.getConnection(DriverManager +.java:708) at java.sql/java.sql.DriverManager.getConnection(DriverManager +.java:230) at TeradataConnectionTest.testConnection(TeradataConnectionTes +t.java:15) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.i +nvoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at InlineJavaUserClassLink.invoke(InlineJavaUserClassLink.java +:11) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.i +nvoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:577) at org.perl.inline.java.InlineJavaUserClassLoader.invoke_via_l +ink(InlineJavaUserClassLoader.java:86) at org.perl.inline.java.InlineJavaUserClassLoader.invoke(Inlin +eJavaUserClassLoader.java:131) at org.perl.inline.java.InlineJavaProtocol.CallJavaMethod(Inli +neJavaProtocol.java:283) at org.perl.inline.java.InlineJavaProtocol.Do(InlineJavaProtoc +ol.java:41) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:153) at org.perl.inline.java.InlineJavaServer.ProcessCommand(Inline +JavaServer.java:142) at org.perl.inline.java.InlineJavaServerThread.run(InlineJavaS +erverThread.java:51) SQLException: No suitable driver found for jdbc:teradata://172.28.130. +20/TMODE=TERA,DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW;T +eraDriver=com.teradata.jdbc.TeraDriver

So, it is almost like it is calling out to the trino driver, not the Teradata driver. How would appropriately register the driver, what is the syntax?


In reply to Re^4: Inline Java not working by mallett76
in thread Inline Java not working 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.