0
votes

I am trying to connect to Teradata database from R terminal using code below,

 "> con <- DBI::dbConnect(odbc::odbc(),
  + Driver = "Teradata",
  + Host   = "xxxx",
  + DBCName = "xxxx",
  + UID    = "xxxx"
  + )"

I have created /etc/odbc.ini and /etc/odbcinst.ini and below are the contents of the same,

odbc.ini:

 [ODBC]
 InstallDir=/opt/teradata/client/16.20/odbc_64
 DataEncryption='ON'

 [ngmtdd01]
 Driver=/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so
 Description=Teradata Dev
 DBCName=xxxx.dev.uk.capitalone.com
 LoginTimeout=120

odbcinst.ini

[ODBC DRIVERS]
Teradata Database ODBC Driver 16.20=Installed

[Teradata Database ODBC Driver 16.20]
Driver=/opt/teradata/client/16.20/odbc_64/lib/tdataodbc_sb64.so
APILevel=CORE
ConnectFunctions=YYY
DriverODBCVer=3.51
SQLLevel=1

I expected to get connected to the teradata cli but I am getting below error.

Error: nanodbc/nanodbc.cpp:950: IM002: [DataDirect][ODBC lib] Data source name not found and no default driver specified"

1

1 Answers

0
votes

You defined a DSN but your connection string is "DSN-less" (using Driver= not DSN=) and Driver= specifies the wrong driver name; the actual name is Teradata Database ODBC Driver 16.20

Note that Teradata also supplies a Teradata SQL Driver for R package that does not require ODBC.