Upcoming changes to RStudio in Db2 Warehouse on Cloud

5 min read

By: Ben Hudson

Upcoming changes to RStudio in Db2 Warehouse on Cloud

Db2 Warehouse on Cloud is a perfect persistence layer to support dashboards and advanced analytic applications. It integrates with BI tools like Tableau and Looker, and comes packed with in-database analytic capabilities supercharged by BLU Acceleration technology. It also connects seamlessly to Watson Studio (formerly known as Data Science Experience, or DSX) so you can utilize familiar tools, such as Jupyter Notebooks and RStudio, to dive into data stored in Db2 Warehouse on Cloud.

RStudio in Watson Studio provides the same functionality as RStudio currently deployed with Db2 Warehouse on Cloud. In addition, Watson Studio’s Lite plan allows you to explore all of its collaborative data science features in one place, including its integrated Watson Machine Learning capabilities, and make deeper decisions about your business quicker. We’ve decided to deprecate built-in support of RStudio in all existing and future Db2 Warehouse on Cloud deployments starting January 24th, 2019, in favor of having Watson Studio as a single, collaborative hub for your data science workflow.

Below, we’ve outlined some steps you can take to migrate your R scripts from the RStudio environment in your Db2 Warehouse on Cloud instance to RStudio in Watson Studio (provided you have already set up a Watson Studio instance at https://www.ibm.com/cloud/watson-studio):

  1. Open RStudio in your Db2 Warehouse on Cloud instance.

  2. In RStudio, navigate to the Files tab in the lower right panel of the RStudio console, and select all the directories and files you want to migrate using More → Export. The exported file, or zip file containing the exported directories and files, will be saved in the default download directory on your desktop.

    RStudio

  3. Now, open RStudio in your Watson Studio instance. You can find it under the Tools menu.

  4. Run the following commands to ensure that the ibmdbR and RODBC packages are loaded:

    1. install.packages('ibmdbR')
    2. install.packages('RODBC')
  5. In the Files tab in the lower right panel of the RStudio console, click Upload. In the pop-up window that appears, select the zip file you downloaded in the previous step. RStudio will then upload the file and unpack it in the RStudio home directory.

    in the RStudio home directory

  6. The odbcConnect function of the RODBC package and the idaConnect function of the ibmdbR package are used to establish a connection to a Db2 database. You’ll need to specify user ID and password values as parameters to these functions to connect RStudio in Watson Studio to a remote Db2 Warehouse on Cloud instance. From the Bluemix console, open the Service connections panel for your Db2 Warehouse on Cloud instance, and click View Credentials.

    View Credentials

  7. Locate the line in your credentials that gives the DSN value – it’ll look similar to the following example:

    • "dsn": "DATABASE=BLUDB;HOSTNAME=your-hostname-here;PORT=50000;
      PROTOCOL=TCPIP;UID=your-uid-here;PWD=your-password-here;"
  8. Now, in your R script in Watson Studio, locate the line which looks similar tocon <- idaConnect('BLUDB','','') or con <- odbcConnect('BLUDB','',''), and replace it with the following commands:

    • dsn <- "DATABASE=BLUDB;HOSTNAME=your-hostname-here;PORT=50000;
      PROTOCOL=TCPIP;UID=your-uid-here;PWD=your-password-here;", and
    • con <- idaConnect(paste('BLUDB;', dsn, '')) or con <- odbcConnect(paste('BLUDB;', dsn, '')), depending on the line you located in the step above

As part of this change, we are removing the two REST APIs (/rscript and /rscript{filename}) that allowed R scripts to be run remotely.  No replacement is available for these API calls.

To prepare for this upcoming change, we’ve already removed the link to RStudio in the Db2 Warehouse on Cloud web console and disable the REST APIs. You’ll still be able to access your instance’s RStudio environment through the direct URL to RStudio until the complete removal on January 24th, 2019.

Note: This blog post has been updated with new information to provide our new schedule.

Be the first to hear about news, product updates, and innovation from IBM Cloud