我已经创建了与Db2 Warehouse on Cloud的连接:dashDB for Analytics-t1 / Database:BLUDB。我已经将'dashdb connect'作为连接名称。
然后我选择了Tools / RStudio。在RStudio中,我运行了以下几行。以下错误消息。
代码段:
library(ibmdbR)
con <- idaConnect('BLUDB','','')
#Close the connection
idaClose(con)
输出:
con <- idaConnect('BLUDB','','')
Warning messages:
1: In RODBC::odbcDriverConnect("DSN=BLUDB", believeNRows = FALSE) : [RODBC] ERROR: state 08001, code -30082, message [unixODBC][IBM][CLI Driver] SQL30082N Security processing failed with reason "17" ("UNSUPPORTED FUNCTION"). SQLSTATE=08001
2: In RODBC::odbcDriverConnect("DSN=BLUDB", believeNRows = FALSE) : ODBC connection failed
答案 0 :(得分:1)
只有从DB2 Warehouse控制台在RStudio中运行代码段时,您的代码段才能正常工作。如果在DSX中启动RStudio,则需要配置连接。以下对我有用:
install.packages("ibmdbR")
library(ibmdbR)
dsn_driver <- "BLUDB"
dsn_database <- "BLUDB"
dsn_hostname <- "..."
dsn_port <- "50000"
dsn_protocol <- "TCPIP"
dsn_uid <- "..."
dsn_pwd <- "..."
con_path <- paste(dsn_driver,";DATABASE=",dsn_database,";HOSTNAME=",dsn_hostname,";PORT=",dsn_port,";PROTOCOL=",dsn_protocol,";UID=",dsn_uid,";PWD=",dsn_pwd,sep="")
ch <-idaConnect(con_path)
idaInit(ch)
idaShowTables()
用您的凭据替换“...”,您应该好好去。 我按照此页面上名为“连接到RStudio中的dashDB”的视频中的说明进行操作:https://datascience.ibm.com/docs/content/analyze-data/rstudio-overview.html并找到以下文档:https://datascience.ibm.com/blog/dashdb-r-dsx/