1

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.

Saraida
  • 39
  • 7
  • Do you have the Driver installed on your machine? Check all installed drivers/DSNs with `odbcDataSources()`. – Parfait Jul 14 '16 at 21:04
  • @Parfait I did download one. Are their additional steps that I should take after I download and run the driver or should it just automatically register the driver ? – Saraida Jul 15 '16 at 13:28

3 Answers3

1

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
1

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.

0

Did you follow the instructions from the following link, you will need to install ibmdbR package as it is mentioned in the below link.

https://www.ibm.com/support/knowledgecenter/SS6NHC/com.ibm.swg.im.dashdb.doc/connecting/connect_connecting_rstudio.html

Kiran
  • 46
  • 1
  • Hey I also did it with the ibmdbR package and it gives me the same error. – Saraida Jul 15 '16 at 13:34
  • Warning messages: 1: In odbcDriverConnect(con.text) : [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data source name not found, and no default driver specified 2: In odbcDriverConnect(con.text) : ODBC connection failed – Saraida Jul 15 '16 at 13:34