Attempting to connect to an IBM db2 database in R results in R not responding

97 Views Asked by At

I am trying to access a db2 database using R. I have downloaded and installed the driver to do so. However, when I enter my code into Rstudio, it gives no response and essentially no longer responds to my lines of code. Here is my code:

install.packages("RODBC")
library(RODBC)
dsn_driver <- "{IBM DB2 ODBC Driver}"
dsn_database <- "bludb"          
dsn_hostname <- "--HOSTNAME--"
dsn_port <- "--PORT--"
dsn_protocol <- "TCPIP"           
dsn_uid <- "--USERNAME--"       
dsn_pwd <- "--PASSWORD--"     
dsn_security <- "ssl"

conn_path <- paste("DRIVER=",dsn_driver,
                   ";DATABASE=",dsn_database,
                   ";HOSTNAME=",dsn_hostname,
                   ";PORT=",dsn_port,
                   ";PROTOCOL=",dsn_protocol,
                   ";UID=",dsn_uid,
                   ";PWD=",dsn_pwd,
                   ";SECURITY=",dsn_security,        
                   sep="")
conn <- odbcDriverConnect(conn_path)
conn
attributes(conn)

However, once I execute "conn <- odbcDriverConnect(conn_path)" R no longer lets me execute lines of code, not even print("hello"). Here is my console for an example:

> conn <- odbcDriverConnect(conn_path)
conn
print("hi")

This results in nothing happening.

I'm mostly certain that I installed the driver correctly--at least it said it was completed successfully. I've tried restarting R Studio and that does not fix it either.

I am running Mac OS Ventura 13.1 and R Studio version RStudio 2023.06.0+421.

0

There are 0 best solutions below