Partha
Partha

Reputation: 47

Unable to connect to DB2 Database using ODBC and FreeTDS Driver

I am unable to connect my to ODBC using FreeTDS driver. I work on a Mac with High Sierra 10.13.4. (I tried using the IBM DB2 driver. It also does not work. So, I am trying with FreeTDS).

I have installed FreeTDS Driver. However, I do not know how to configure it.

I am connecting to DB2 Database on IBM Cloud.

The code is as follows:

dsn_driver <- "FreeTDS"
dsn_tdsVersion <- "7.0"
dsn_database <- "BLUDB"            # e.g. "BLUDB"
dsn_hostname <- "dashdb-entry-yp-lon02-01.services.eu-gb.bluemix.net" # e.g.: "awh-yp-small03.services.dal.bluemix.net"
dsn_port <- "50000"                # e.g. "50000"
dsn_protocol <- "TCPIP"            # i.e. "TCPIP"
dsn_uid <- "<UID>"        # e.g. "dash104434"
dsn_pwd <- "<PWD>"      # e.g. "7dBZ39xN6$o0JiX!m"
conn_path <- paste("DRIVER=",dsn_driver,
                   ";TDS_Version=",dsn_tdsVersion,
                   ";SERVER=",dsn_hostname,
                   ";PORT=",dsn_port,
                   ";DATABASE=",dsn_database,
                   ";PROTOCOL=",dsn_protocol,
                   ";UID=",dsn_uid,
                   ";PWD=",dsn_pwd,";Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;",sep=""
                   )

conn <- odbcDriverConnect(conn_path)
conn

The error is as follows:

===
50: In odbcDriverConnect(conn_path) :
  [RODBC] ERROR: state IM003, code 317533848, message [iODBC][Driver Manager]Specified driver could not be loaded
===

Upvotes: 0

Views: 458

Answers (1)

mao
mao

Reputation: 12287

TDS is a protocol relevant for Sybase RDBMS and Microsoft SQL-server. You cannot use freeTDS to connect to a Db2 RDBMS.

Upvotes: 4

Related Questions