I removed the comments to make it easier to read.

Here is the updated code.

use Inline Java => <<'END_OF_JAVA_CODE' ; import java.sql.*; public class T20000JD { // Name of the user able to create, drop, and manipulate tables public static String sUser = "XXXXX"; public static String sPassword = "XXXXX"; public static void main(String args[]) throws ClassNotFoundException { String url = "jdbc:teradata://172.28.130.20/TMODE=TERA,DBS_PORT=1025, +CHARSET=UTF8,LOGMECH=LDAP,SSLMODE=ALLOW"; String sDropTbl = "DROP TABLE NED_COLL_TABLES.T_PM_TEST_TMP"; String sCreateTbl = "CREATE TABLE NED_COLL_TABLES.T_PM_TEST_TM +P (empID INTEGER NOT NULL, " + "empName VARCHAR(30) NOT NULL, empDept VARCHAR(50) NOT NUL +L, " + "empJob VARCHAR(300), PRIMARY KEY(empID))"; String sCreateIdx = "CREATE INDEX (empName) ON employee"; String sCreateIdx2 = "CREATE UNIQUE INDEX (empName, empDept) O +N employee"; try { System.out.println("\n Sample T20000JD: \n"); System.out.println(" Looking for the Teradata JDBC driver. +.. "); Class.forName("com.teradata.jdbc.TeraDriver"); System.out.println(" JDBC driver loaded. \n"); System.out.println(" Attempting to connect to Teradata via +" + " the JDBC driver..."); Connection con = DriverManager.getConnection(url, sUser, s +Password); System.out.println(" User " + sUser + " connected."); System.out.println(" Connection to Teradata established. \ +n"); try { Statement stmt = con.createStatement(); System.out.println(" Statement object created. \n"); try { try { System.out.println(" Dropping table if present +: " + sDropTbl); // Executing the drop table command stmt.executeUpdate(sDropTbl); System.out.println(" Table dropped.\n"); } catch (SQLException ex) { while (ex != null) { System.out.println("\n Drop table exceptio +n " + "ignored: " + ex); System.out.println(" Error code: " + ex.getErrorCode()); System.out.println(" SQL State: " + ex.getSQLState()); System.out.println(" Message: " + ex.getMessage()); System.out.println(" Localized Message: " + ex.getLocalizedMessag +e()); System.out.println(" Stack Trace: "); ex.printStackTrace(); ex = ex.getNextException(); } System.out.println(" Table could not be droppe +d." + " Execution will continue.. +.\n"); } System.out.println(" Creating table: " + sCreateTb +l); stmt.executeUpdate(sCreateTbl); System.out.println(" Sample table created. \n"); System.out.println(" Creating table indexes: " + sCreateIdx + " " + sCreateIdx +2); stmt.executeUpdate(sCreateIdx); stmt.executeUpdate(sCreateIdx2); System.out.println(" Table indexes created."); } finally { stmt.close(); System.out.println("\n Statement object closed. \n +"); } } finally { System.out.println(" Closing connection to Teradata... +"); con.close(); System.out.println(" Connection to Teradata closed. \n +"); } System.out.println(" Sample T20000JD finished. \n"); } catch (SQLException ex) { System.out.println(); System.out.println("*** SQLException caught ***"); while (ex != null) { System.out.println(" Error code: " + ex.getErrorCode() +); System.out.println(" SQL State: " + ex.getSQLState()); System.out.println(" Message: " + ex.getMessage()); ex.printStackTrace(); System.out.println(); ex = ex.getNextException(); } throw new IllegalStateException ("Sample failed.") ; } } // End main } // End class T20000JD END_OF_JAVA_CODE

In reply to Re^2: 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.