Unable to get past TdgssConfigApi.GetMechanisms with JDBC Driver 16.20.00.06

Connectivity
Highlighted

Unable to get past TdgssConfigApi.GetMechanisms with JDBC Driver 16.20.00.06

I extracted everything to a plain maven project for java 1.8 with the following dependencies

   <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.25</version>
        </dependency>
        <dependency>
            <groupId>com.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>3.7</version>
        </dependency>
        <dependency>
            <groupId>com.teradata</groupId>
            <artifactId>terajdbc4</artifactId>
            <version>16.20.00.06</version>
        </dependency>
        <dependency>
            <groupId>com.teradata</groupId>
            <artifactId>tdgssconfig</artifactId>
            <version>16.20.00.06</version>
        </dependency>
    </dependencies>

I have a java class which tries to get a connection to the database, but I always get the same NullPointerException...and despite checking out similar experience online believe I have all the requisites in the dependencies and code.



package com.expedia.www.teradata;

import java.sql.*;

public class Vanilla {

    public static void main(String[] args) throws Exception {
        String driver = "com.teradata.jdbc.TeraDriver",
                url = "jdbc:teradata://myServerHost/USER=test,Password=test,LOGMECH=LDAP",
                query = "SELECT column1 FROM table1";

        Class.forName(driver);
        try (Connection conn = DriverManager.getConnection(url)) {
            try (Statement statement = conn.createStatement()) {
                try (ResultSet resultSet = statement.executeQuery(query)) {
                }
            }
        }
    }
}


It also seems that both the jars tdgssconfig and terajdbc4 have the same content so I'm not really sure why it is required to have both of them.
Is this version of the driver not JDK 1.8 compatible, or are there any hidden dependencies I need to add ?
It would also be useful to know how I can setup logging properly to see on the command any issues that are happening.
When I tried to connect inside the code of our main codebase I was seeing the following message in the debugger "com.teradata.tdgss.jtdgss.TdgssConfigApi.<init>(Unknown Source) (Thread # main) : Failure unspecified at GSS-API level (Mechanism level: [TDGSS_ERR_CFG_USER_FILE_BAD] User File parameter passed is null.)"

Current exception from the above code.

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.teradata.jdbc.jdbc.GenericTeraEncrypt.getGSSM(GenericTeraEncrypt.java:577)
	at com.teradata.jdbc.jdbc.GenericTeraEncrypt.<init>(GenericTeraEncrypt.java:116)
	at com.teradata.jdbc.jdbc.GenericTeradataConnection.<init>(GenericTeradataConnection.java:108)
	at com.teradata.jdbc.jdbc_4.TDSession.<init>(TDSession.java:187)
	at com.teradata.jdbc.jdk6.JDK6_SQL_Connection.<init>(JDK6_SQL_Connection.java:36)
	at com.teradata.jdbc.jdk6.JDK6ConnectionFactory.constructSQLConnection(JDK6ConnectionFactory.java:25)
	at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:181)
	at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:171)
	at com.teradata.jdbc.TeraDriver.doConnect(TeraDriver.java:236)
	at com.teradata.jdbc.TeraDriver.connect(TeraDriver.java:162)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:270)
	at com.expedia.www.teradata.Vanilla.main(Vanilla.java:13)
Caused by: java.lang.NullPointerException
	at com.teradata.tdgss.jtdgss.TdgssConfigApi.GetMechanisms(Unknown Source)
	at com.teradata.tdgss.jtdgss.TdgssManager.<init>(Unknown Source)
	at com.teradata.tdgss.jtdgss.TdgssManager.<clinit>(Unknown Source)
	... 13 more

Accepted Solutions

Re: Unable to get past TdgssConfigApi.GetMechanisms with JDBC Driver 16.20.00.06

It looks like it is the driver version. I was blocked from getting the latest 16.20.00.10 via our repo proxies, so I decided to download it and install to my local maven repo.

 

After I upgrade the version in the pom I get a syntax issue on the SQL, so it is working !

1 ACCEPTED SOLUTION
3 REPLIES 3

Re: Unable to get past TdgssConfigApi.GetMechanisms with JDBC Driver 16.20.00.06

It looks like it is the driver version. I was blocked from getting the latest 16.20.00.10 via our repo proxies, so I decided to download it and install to my local maven repo.

 

After I upgrade the version in the pom I get a syntax issue on the SQL, so it is working !

Teradata Employee

Re: Unable to get past TdgssConfigApi.GetMechanisms with JDBC Driver 16.20.00.06

>>> It also seems that both the jars tdgssconfig and terajdbc4 have the same content

 

No, the two jar files do not contain the same content. terajdbc4.jar contains the class files for the Teradata JDBC Driver. tdgssconfig.jar contains the XML configuration file for the Teradata authentication methods.

 

>>> Is this version of the driver not JDK 1.8 compatible

 

Yes Teradata JDBC Driver 16.20.00.06 is compatible with JDK 1.8.

 

The exception you are getting occurs when tdgssconfig.jar is not available on your classpath.

Re: Unable to get past TdgssConfigApi.GetMechanisms with JDBC Driver 16.20.00.06

Somebody must have uploaded a duplicate of terajdbc4 as tdgssconfig into the repository we use.

Having downloaded the newer version I can see there is a diffeence.

 

Thanks