Skip to content

Connect to Sybase IQ 15.2 from R on Mac OS 10.6

September 6, 2012

Introduction

The following procedure explains how to establish connectivity from R 2.15.1 installed on Mac OS 10.6 (Snow Leopard) using JDBC.

Environment

The procedure here described has been tested using the following environment:

  • RGUI for R 32b version 2.15.1 on Mac OS 10.6 (Snow Leopard).
  • And account on the Mac OS with administrator privileges.
  • Sybase IQ 15.2 ESD # 3 on Solaris 10, Sun Sparc x64 architecture.
  • Sybase JConnect 7.07
  • JDK 1.6.0

High Level procedure

  1. Download Sybase Software Developer’s Kit 15.5 ESD#8 for Mac OS (EBF18435.dmg) and install jConnect 7.
  2. Add the JDBC_HOME and CLASSPATH environment variables to the Info.plist file in the R package.
  3. Install the RJDBC packages and all it dependencies.
  4. Load the RJDBC package and all it dependencies.
  5. Test connectivity.

Please note that only the 32b version of the JDBC is provided with the SDK 15.5.

Detailed Procedure

Install SDK 15.5 ESD#8 for Mac OS

  1. Download the SDK 15.5 ESD#8 for Mac OS from Sybase Support website (EBD18435.dmg).
  2. Execute the Installer package SDK15.5_ESD8.mpkg
  3. On the “Welcome to Sybase Software Developer’s Kit” click on the button Continue“.

  1. Read and accept the Sybase license agreement.

  1. At this point, you can change the install location or accept the default, then press the button Customize.

  1. Since we only need to install jConnect 7, unselect all the other components and click on the button start.

  1. If you do not have administrative privileges, at this point the system will require an administrator account to install the component. If required, provide the users name and password of the account with administrative privileges and press the button OK.

  1. After the installation is complete, closet the SDK 15.5 installation window.

Set the JDBC_HOME and CLASSPATH environment variables

  1. Verify the R is close, it not close it.
  2. With Finder, show the R package contents (be careful not to choose R64).

  1. Make a backup of the Info.plist file (in my case, I made a copy and named Info_plist.uv.

  1. Edit the Info.plist file to set the JDBC_HOME and CLASSPATH environment variable; Near the end of the file, just before the last </dict> </plist> add the XML code to declare the JDBC_HOME and CLASSPATH environment variables, please verify the correctness of the path.

R won’t start if there are and error on this file.

Install the RJDBC packages and all it dependencies

  1. Start R.

  1. Go to Package Installer and click on Get List.

  1. Select your region, and press on the button OK.

  1. Scroll down and select the RJDBC Package. Select the options “At user level” and “Install Dependencies” and then click in the button Install Selected.

Load the RJDBC package and all it dependencies

  1. On the menu, select the option ‘Packages & Data” à Manage Packages and load the DBI, rjava and RJDBC packages

Test connectivity

  1. Create a new DBI object (correct the path to point to the folder where you installed jConnect7).

> drv<-JDBC(“com.sybase.jdbc4.jdbc.SybDriver”, “/Users/usomarriba/Sybase/jConnect-7_0/classes/jconn4.jar”, “\””)

  1. Create a new dbConnect object

> conn <- dbConnect(drv, “jdbc:sybase:Tds:o:4200”, “myUser”, “MyPassword”)

In this example I’m connecting to a server named myserver where Sybase IQ is accepting connections on port 4200. I connect with the user “myUser” secure with the password “myPassword”.

  1. Test if the connection is working.

> dbListTables(conn)

A list of all the tables in the database should be displayed.

Done!

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: