Easiest connectivity for complicated environments?


Easiest connectivity for complicated environments?

Java 1.8 / Spring 4.0 / myBatis 3 / WebSphere RAD / WebSphere App Server 8.5

I'm new to Teradata but have a lot of experience with big blue techologies, IBM DB2. I am writing a CONVERSION program that will read a simple Teradata  table, use those data elements to update matching rows in a DB2 table. My java application uses myBatis and Spring for connectivity to DB2. I have the JDBC drivers installed, my WebSphere server will connect to Teradata, I'm almost there! 


I've seen articles about Eclipse plugins but that seems overkill for this process. I don't control production servers so I want to limit impact to that group when ready for deployment. I want to stress again, this is SHORT term. Once the mainframe DB2 tables are updated, all Teradata code and connectivity will be removed from the java application.


Would this type of code be the easiest way to connect and get the data I need?   Instead of installing plugins, etc., we use XML configurations for database definitions, example included below.


import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.PreparedStatement;

import java.sql.ResultSet;


public class HelloTeradataJDBC {

public static execute throws Execption  {

String connURL="jdbc:teradata://mydatabase info.URL";


Connection conn=DriverManager.getConnection(connURL, "javauser", "password");

String query="select * from MYschema.TableName WHERE tdKey = db2Key";

PreparedStatement stmt=conn.prepareStatement(query);

ResultSet rs=stmt.executeQuery();


while(rs.next()) {

  String col1=rs.getString(1);





The downside to this is the loss of managed connectivity and automatic mapping for database elements into the data object. I only need one connection.

Any insight would be greatly appreciated!

Thank you.


<!-- ********** DB2 TABLE CONFIG ************ -->

<bean id = "db2DAO"    class = "org.mybatis.spring.mapper.MapperFactoryBean"

p:mapperInterface = "**bleep**.dao.table.DB2DAO"

p:sqlSessionFactory-ref = "db2SqlSessionFactory" />


<bean id = "db2SqlSessionFactory"

class = "org.mybatis.spring.SqlSessionFactoryBean"

p:dataSource-ref = "db2DataSource" />


<jee:jndi-lookup id = "db2DataSource"

jndi-name = "jdbc/db2Table"

lookup-on-startup = "false"

cache = "true"

proxy-interface = "javax.sql.DataSource"

resource-ref = "true" />

Teradata Employee

Re: Easiest connectivity for complicated environments?

Yes, that's the easiest way to connect using the Teradata JDBC Driver.

We offer a large number of sample Java programs that demonstrate how to use the Teradata JDBC Driver.