Skip to content
Advertisement

Teradata and JDBC driver – classnotfoundexception …but its there?

Trying to work with a JDBC connection to Teradata. I’ve loaded the tdgssconfig.jar and terajdbc4.jar file and adding them to the classpath with javac when I compile in Linux. But I still get a ClassnotFoundException when trying to compile.

I’ve not worked with java in a while, but I’ve scoured the net and it looks like it should work.

Simple Code:

JavaScript

*.jars are definitely there:

JavaScript

verbose error log – it looks like the classpath is right to me:

JavaScript

I’ve tried un-jar’ing the jdbc jar’s and they definitely have com/teradata/jdbc/TeraDriver.class in them.

I’m at a loss. Any idea what I’m doing wrong?

Advertisement

Answer

The compiler is not looking for the class com.teradata.jdbc.TeraDriver from your jar file, it is reacting to the Class.forName() statement.

As Class.forName() throws ClassNotFoundException which is a checked exception, you will need to handle it.

You could either surround the exception in a `try/catch’ block or throw the exception to compile:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement