This article describes how to create a new connection in R to SQream via the JDBC driver.
In the R console, type:
If this succeeds, skip to the next step. Otherwise, install by typing:
and then type
again to verify that the install succeeded.
You will need the following JAR file:
Our example assumes that the driver is copied to C:\Java\JARs (Windows). For Linux this would be an appropriate working directory.
Below is a sample connection script. Make sure to match it your connection and java classpaths. Specifically, note <your server address>, <your server port>, <your database name>, <SQream user name> and <password of SQream user>
We will first create a classpath and initialize the Java runtime around it, and then create a new connection.
In our example we're querying a table 'test_table' that has two columns, x and y and two rows of data.
> cp = c("C:\\Java\\JARs\\SqreamJDBC.jar") > .jinit(classpath=cp)  0 > drv <- JDBC("com.sqream.jdbc.SQDriver","C:\\Java\\JARs\\SqreamJDBC.jar") > con <- dbConnect(drv,"jdbc:Sqream://<your server address>:<your server port>/<your database name>;user=<SQream user name>;password=<password of SQream user>;cluster=<TRUE/FALSE>;ssl=<TRUE/FALSE>") > dbGetQuery(con,"SELECT COUNT(*) as cnt FROM test_table") cnt 1 2 > dbGetQuery(con,"SELECT * FROM test_table") x y 1 1 5 2 4 6
For any further assistance please contact SQream support.