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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class.forName("com.teradata.jdbc.TeraDriver"); | |
String connectionString = "jdbc:teradata://MyDatabaseServer/database=MyDatabaseName,tmode=ANSI,charset=UTF8"; | |
String user = "username"; | |
String passwd = "password"; | |
Connection conn = DriverManager.getConnection(connectionString, user, password); |
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 :
