JDBC Connection from Oracle 11g Java Stored Procedure

Connectivity

JDBC Connection from Oracle 11g Java Stored Procedure

When using a Java Stored Procedure from within the Oracle 11g database, an attempt to open a connection to Teradata using the JDBC driver version 14 throws the following error.

Exception in thread "Root Thread" java.lang.NullPointerException

at com.teradata.jdbc.jdbc_4.parcel.ClientAttributesParcel.<init>(ClientAttributesParcel.java:75)

at com.teradata.jdbc.jdbc.GenericLogonController.run(GenericLogonController.java:608)

at com.teradata.jdbc.jdbc_4.TDSession.<init>(TDSession.java:218)

at com.teradata.jdbc.jdk14.JDK14_SQL_Connection.<init>(JDK14_SQL_Connection.java:31)

at com.teradata.jdbc.jdbc.ConnectionFactory.constructSQLConnection(ConnectionFactory.java:106)

at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:179)

at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:169)

at com.teradata.jdbc.TeraDriver.doConnect(TeraDriver.java:232)

at com.teradata.jdbc.TeraDriver.connect(TeraDriver.java:158)

at java.sql.DriverManager.getConnection(DriverManager.java:583)

at java.sql.DriverManager.getConnection(DriverManager.java:187)

at TDTest.requestPriceDetails(TDTest:12)

The connection code is:

create or replace and compile java source named "TDTest" as

  // Required class libraries.

  import java.sql.*;

  import oracle.jdbc.driver.*;

  import oracle.aurora.util.*;

  import com.teradata.jdbc.*;

  public class TDTest {

    public static int requestPriceDetails(String anchor, Integer rc, Integer sg, String upc, Integer req_id) throws SQLException {

      com.teradata.jdbc.TeraDriver td = new com.teradata.jdbc.TeraDriver();

      String tdConnectionString = "jdbc:teradata://tddev1cop1.ngco.com";

      Connection tdConn = DriverManager.getConnection(tdConnectionString, "user", "password");

      return 0;

    }

  }

The same code works run using the Oracle JVM on the same server. Is there a parameter that needs to be passed in this JVM?

Chris

Tags (2)
1 REPLY
Teradata Employee

Re: JDBC Connection from Oracle 11g Java Stored Procedure

First, the Oracle Database server-side JVM for Oracle Java Stored Procedures is not one of the supported environments for the Teradata JDBC Driver.

Having said that, this problem corresponds to a known issue -- JDBC DR 167176 Avoid NullPointerException at logon when System property "java.vm.info" is not set

We will be shipping a Teradata JDBC Driver change to address that issue soon. In the meantime, you can work around this Oracle JVM issue by setting the System property "java.vm.info" yourself to some value -- the actual value doesn't matter; it simply needs to be non-null.

System.setProperty("java.vm.info", "Oracle Database JVM");