Reputation: 39
When trying to set up a connection to dashDB from the rstudio ide on DSX I get this error:
[RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified
This is after filling out this
dsn_driver <- "{IBM DB2 ODBC Driver}"
dsn_database <- "BLUDB" # e.g. "BLUDB"
dsn_hostname <- "<Enter Hostname>" # e.g.: "awh-yp-small03.services.dal.bluemix.net"
dsn_port <- "50000" # e.g. "50000"
dsn_protocol <- "TCPIP" # i.e. "TCPIP"
dsn_uid <- "<Enter UserID>" # e.g. "dash104434"
dsn_pwd <- "<Enter Password>" # e.g. "7dBZ39xN6$o0JiX!m"
conn_path <- paste("DRIVER=",dsn_driver,
";DATABASE=",dsn_database,
";HOSTNAME=",dsn_hostname,
";PORT=",dsn_port,
";PROTOCOL=",dsn_protocol,
";UID=",dsn_uid,
";PWD=",dsn_pwd,sep="")
conn <- odbcDriverConnect(conn_path)
conn
So this code does not work for me. Is there anything I am missing here? I imported the RODBC library.
Upvotes: 1
Views: 994
Reputation: 391
Instead of using odbcConnect you can also load package ibmdbR and use it's idaConnect method and it's dashDB push down data.frame API.
Upvotes: 1
Reputation:
You can use the odbcConnect()
and provide the dsn
string as the only required parameter. On DSX, IBM DB2 ODBC DRIVER is initialized with the name BLUDB
(so dsn_driver <- 'BLUDB'). Here is the working example:
dsn_driver <- "BLUDB"
dsn_database <- "BLUDB" # e.g. "BLUDB"
dsn_hostname <- "<Enter Hostname>" # e.g.: "awh-yp-small03.services.dal.bluemix.net"
dsn_port <- "50000" # e.g. "50000"
dsn_protocol <- "TCPIP" # i.e. "TCPIP"
dsn_uid <- "<Enter UserID>" # e.g. "dash104434"
dsn_pwd <- "<Enter Password>" # e.g. "7dBZ39xN6$o0JiX!m"
conn_path <- paste(dsn_driver,
";DATABASE=",dsn_database,
";HOSTNAME=",dsn_hostname,
";PORT=",dsn_port,
";PROTOCOL=",dsn_protocol,
";UID=",dsn_uid,
";PWD=",dsn_pwd,sep="")
conn <- odbcConnect(conn_path)
conn
Upvotes: 1
Reputation: 46
Did you follow the instructions from the following link, you will need to install ibmdbR package as it is mentioned in the below link.
Upvotes: 0