Summary
This article updates Teradata Client on Linux instructions from section 10.2 of the RevoScaleR Teradata Getting Started Guide to account for changes in the distribution and packaging of Teradata 14.10 ODBC client drivers since the publication of the guide.
More Information
Ensure unixODBC has not been installed via rpm. If it has remove it prior to trying to install unixODBC 2.3.1.
# rpm -qa | grep unixODBC
This should return nothing; if any packages are listed, use yum to remove them:
# yum remove <package>
Install other prerequisite packages necessary for the successful build and installation of the drivers:
# yum install ksh
# yum install gcc
# yum install make
Create a link to ksh so the tdodbc rpm will properly install:
# ln -s /bin/ksh /usr/bin/ksh
Build and install the unixODBC 2.3.1 driver manager:
# mkdir ~/downloads
# cd ~/downloads
# wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.1.tar.gz
# tar -zxf unixODBC-2.3.1.tar.gz
# cd unixODBC-2.3.1
By default configure will cause unixodbc to install under /usr/local/
# ./configure
# make
# make install
Install the Teradata ODBC drivers Get the files:
# cd ~/downloads
# mkdir teradata_odbc
# cd teradata_odbc
http://downloads.teradata.com/download/connectivity/odbc-driver/linux and download tdodbc__linux_indep.14.10.00.00-1.tar.gz to directory teradata_odbc.
Sign in to
# tar -zxf tdodbc__linux_indep.14.10.00.00-1.tar.gz
# tar -zxf tdicu__linux_indep.14.10.00.00-1.tar.gz
# tar -zxf TeraGSS_linux_x64__linux_indep.14.10.00.06-1.tar.gz
Install RPMs:
# rpm -ihv tdicu/tdicu-14.10.00.00-1.noarch.rpm
# source /etc/profile
# rpm -ihv TeraGSS/TeraGSS_linux_x64-14.10.00.06-1.noarch.rpm
# rpm -ihv tdodbc/tdodbc-14.10.00.00-1.noarch.rpm
Update ODBC ini files. To find the ini files enter:
# odbcinst -j
Edit odbcinst.ini (drivers) and add the following:
[Teradata]
Driver=/opt/teradata/client/14.10/odbc_64/lib/tdata.so
APILevel=CORE
ConnectFunctions=YYY
DriverODBCVer=3.51
SQLLevel=1
Edit odbc.ini (DSNs) and add the following. Modify Username, Password and Database if desired otherwise leave blank:
[ODBC Data Sources]
TDDSN=tdata.so
[ODBC]
InstallDir=/opt/teradata/client/14.10/odbc_64
Trace=0
TraceDll=/opt/teradata/client/14.10/odbc_64/lib/odbctrac.so
TraceFile=/usr/joe/odbcusr/trace.log
TraceAutoStop=0
[TDDSN]
Driver=/opt/teradata/client/14.10/odbc_64/lib/tdata.so
Description=Teradata database
DBCName=<MachineName or ip>
LastUser=
Username=
Password=
Database=
Verify Teradata connection using isql:
# isql tddsn <username> <password>
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select * from Database.Table;
SQL> quit;
Modify LD_LIBRARY_PATH to so that Revolution R Enterprise can locate the driver:
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(odbc_config --lib-prefix)
# echo $LD_LIBRARY_PATH
Example in Revolution R Enterprise (DSNless). Modify TeradataConnString parameters as needed:
TeradataConnString <- "DRIVER=Teradata;DBCNAME=machinename;DATABASE=databasename;UID=username;PWD=password;"
rxOdbcDS <- RxOdbcData(sqlQuery = "SELECT * FROM db.table", connectionString = TeradataConnString)
rxImport(rxOdbcDS)