We have moved to www.dataGenX.net, Keep Learning with us.

Thursday, May 02, 2013

JDBC connection with Teradata



Today I am going to tell you how to connect to TeraData via JDBC, Here I have used a RazorSQL tool.  For JDBC connection with TeraData, you can find the JDBC drivers here. Teradata JDBC driver enables all Java applications to connect a Teradata database using a well-established industry standard Java Database Connectivity (JDBC) API interface.

A new database connection can be obtained in a standard JDBC way by using java.sql.DriverManager.getConnection method with a proper connection string to get a new instance of java.sql.Connection.

The simplest database connection string would be:

jdbc:teradata://ServerHost/database=MyDatabaseName

There is a number of available connection parameters, all are described in detail in the Teradata JDBC Driver User Guide 

For example, to connect to a Teradata database using ANSI session mode and UTF-8 charset the connection string should be built as follows:

jdbc:teradata://ServerHost/database=MyDatabaseName,tmode=ANSI,charset=UTF8



A sample Java code snippet for obtaining a database connection would look as follows:

Please note that to allow the JVM to access the com.teradata.jdbc.TeraDriver class, the driver classes located in terajdbc4.jar and tdgssconfig.jar files (yes, you need both) should be available in the classpath.

In RazorSQL :


DRIVER CLASS: com.teradata.jdbcTeraDriver

DRIVER LOCATION: Specify the location on your machine of the following
files. Separate the file paths with semi-colons: terajdbc4.jar tdgssjava.jar gui.jar (if necessary)
i.e : driver_path/terajdbc4.jar ; driver_path/tdgssjava.jar gui.jar

JDBC URL FORMAT:
Type 4 = jdbc:teradata://DatabaseServerName/Param1,Param2,...
Type 3 = jdbc:teradata://GatewayServerName:PortNumber
/DatabaseServerName/Param1,Param2,... 



Step 1:



























Step 2:




























 JDBC URL :