无法使用ODBC和FreeTDS驱动程序连接到DB2数据库

时间:2018-04-24 03:25:47

标签: r db2 odbc ibm-cloud freetds

我无法使用FreeTDS驱动程序将我连接到ODBC。我在使用High Sierra 10.13.4的Mac上工作。 (我尝试使用IBM DB2驱动程序。它也不起作用。所以,我正在尝试使用FreeTDS。)

我已经安装了FreeTDS驱动程序。但是,我不知道如何配置它。

我正在IBM Cloud上连接到DB2数据库。

代码如下:

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

错误如下:

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

1 个答案:

答案 0 :(得分:4)

TDS是与Sybase RDBMS和Microsoft SQL-server相关的协议。您无法使用freeTDS连接到Db2 RDBMS。