Wednesday, February 8, 2017

ODBC Connectivity test - UNIX/Linux


When you install the Teradata ODBC driver for UNIX or Linux, you also get a tool called Adhoc, which you can use to test connectivity through ODBC to a Teradata system.

Step 1: odbc.ini configuration:

You need to configure a data source in the odbc.ini file. In the example below, the data source name for the Teradata target system is “tdtest”. DBCname and DBCname2 point to two Teradata nodes defined in the hosts file or DNS on the client machine. Note that the odbc.ini file may be located in another directory, depending on your platform and installation options. In current releases (2012) of ODBC for Linux, the default directory for the ODBC Driver for Teradata is one of the below, depending on the platform:

/opt/teradata/client/ODBC_32
/opt/teradata/client/ODBC_64

odbc.ini example:

[ODBC]
InstallDir=/opt/teradata/client/ODBC_64
Trace=0
TraceDll=/opt/teradata/client/ODBC_64/lib/odbctrac.so
TraceFile=/usr/joe/odbcusr/trace.log
TraceAutoStop=0

[ODBC Data Sources]
default=tdata.so
testdsn=tdata.so
tdtest=tdata.so

[testdsn]
Driver=/opt/teradata/client/ODBC_64/drivers/tdata.so
Description=NCR 3600 running Teradata V1R5.2
DBCName=hpmm2
LastUser=
Username=
Password=
Database=
DefaultDatabase=

[tdtest]
Driver=/opt/teradata/client/ODBC_64/drivers/tdata.so
Description=Teradata test system
DBCName=teradatacop1
DBCName2=teradatacop2
LastUser=
Username=
Password=
Database=
DefaultDatabase=

[default]
Driver=/opt/teradata/client/ODBC_64/drivers/tdata.so
Description=Default DSN is Teradata 5100
DBCName=208.199.59.208
LastUser=
Username=
Password=
Database=
DefaultDatabase=



Step 2: Set the ODBCINI variable:

export ODBCINI=/opt/teradata/client/ODBC_64/odbc.ini


Step 3: Test the connection using adhoc:

/opt/teradata/client/ODBC_64/samples/C/adhoc

Enter Data Source Name: tdtest
Enter userID: systemfe
Enter password:  

.....ODBC connection successful.

ODBC version        = -03.52.0000-
DBMS name           = -Teradata-
DBMS version        = -06.02.0277  V2R-
Driver name         = -tdata.so-
Driver version      = - 12.00.00.01-
Driver ODBC version = -03.51-

Enter SQL string: select date,time;
DateTime
2009-09-29 12:22:15

Enter SQL string: quit

ODBC connection closed.





No comments:

Post a Comment