in reply to Re^3: Inline Java not working
in thread Inline Java not working
Yahoo! - I solved the problem - wasn't easy, but I did it. I'll share my code in case anyone else has the issue. The big item was I had to point to my class path jar file to point to terajdbc4.jar
use strict; use warnings; use Inline Java => <<'END' => CLASSPATH => 'C:/jars/terajdbc4.jar'; import java.sql.Connection; import java.util.*; import java.sql.DriverManager; import java.sql.SQLException; import java.io.PrintWriter; import java.sql.*; public class TeradataConnectionTest { public static void testConnection(String jdbcUrl, String username, Str +ing password) { try { System.out.println("Test up to part 1"); //e.printStackTrace(); //DriverManager.registerDriver(new com.teradata.jdbc.TeraDriver()); //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 connectionA = DriverManager.getConnection(jdbcUrl, username +, password); System.out.println("Test up to part 2"); System.out.println("Connected to Teradata!"); // Perform your database operations here connectionA.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 #COMMENTED OUT ON 2/14/24 my $jdbcUrl = "jdbc:teradata://XXX.XX.XXX.XX +/TMODE=TERA,DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW"; #Here is my JAVA connection String url = "jdbc:teradata://XXX.XX.XXX. +XX/TMODE=TERA,DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW"; #commented out on 2/16/24 my $jdbcUrl = "jdbc:teradata://XXX.XX.XXX.XX +/TMODE=TERA,DBS_PORT=1025,CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW;Ter +aDriver=com.teradata.jdbc.TeraDriver"; my $jdbcUrl = "jdbc:teradata://XXX.XX.XXX.XX/TMODE=TERA,DBS_PORT=1025, +CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW"; #my $jdbcUrl = "jdbc:teradata://XXX.XX.XXX.XX/TMODE=TERA,DBS_PORT=1025 +,CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW"; my $username = "XXXXX"; my $password = "XXXXXX"; # Call the Java method to test the connection TeradataConnectionTest->testConnection($jdbcUrl, $username, $password) +;
|
|---|