Connecting Teradata from Java

Database

Connecting Teradata from Java


Please send me examples/code snippets you may have used to achieve Teradata database connectivity from Java.
2 REPLIES
N/A

Re: Connecting Teradata from Java

Down load the Teradata JDBC driver from Teradate website... then

1. set up connection

private void buildCon() {
try {
Class.forName("com.ncr.teradata.TeraDriver");
con = DriverManager.getConnection(serverURL, username, password);
} catch (Exception e) {
e.printStackTrace();
}
}

2. create statement and execute query
Statement st = con.createStatement();
ResultSet rs = null;
String sql = "........";
rs = st.executequery(sql);
.....deal with your resultset.....

3. close connection
private void closeCon(){
if(con != null){
try {
this.con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}

Re: Connecting Teradata from Java

Hey Ivy,

I am having a problem with the connection string.

I am using the connection string:

jdbc:teradata://HostName/DATABASE=databaseName

i am facing a problem in the time it takes to connect.

The database is in a different network and also in US and i am trying to connect to it from India.

Also i have to be in the US network and then this connection string works.

Is there a connection string which will allow me to connect to the us network from India.

Also Is there a JDBC Driver that will enhance the connectivity speed?

Thanks in advance,
Sylvester