Skip to main content

ROracle in windows 7


Download ROracle

http://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html


set the following Windows variables, according to your installation

OCI_INC = C:\Oracle11_201\product\11.2.0\dbhome_1\OCI\include
OCI_LIB64 = C:\Oracle11_201\product\11.2.0\dbhome_1\BIN


Install ROracle in a CMD window

C:\Users\user\Documents>"C:\Program Files\R\R-3.2.2\bin\r" CMD INSTALL ROracle_1.2-1.zip


In RStudio

> library(ROracle)
Error: package ‘DBI’ required by ‘ROracle’ could not be found

> install.packages("DBI")
Installing package into ‘C:/Users/karatrj1/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/DBI_0.3.1.zip'
Content type 'application/zip' length 162723 bytes (158 KB)
downloaded 158 KB

package ‘DBI’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\karatrj1\AppData\Local\Temp\RtmpMJUGgr\downloaded_packages

> library(DBI)
> library(ROracle)


Testing the connection and querying the DB

> drv <- dbDriver("Oracle")
> con <- dbConnect(drv, username ="rquser", password = "rquser", dbname="dbname or connect string")
> dbGetQuery(con, "select * from dual")
  DUMMY
1     X

Succesfully connected to Oracle in RStudio!




Comments

Popular posts from this blog

NodeJS MSSQL connection error "EINVALIDSTATE"

It took me some time to find the reasons for the connection error below: Requests can only be made in the LoggedIn state, n…", code: "EINVALIDSTATE" I was trying to connect to MS Sql server using Node JS TEDIOUS package. The code from the Microsoft  is very simple and didn't return a more complete error message. This is the original code: ... var connection = new Connection(config);  connection.on( 'connect' , function ( err ) {  // If no error, then good to proceed.  console .log( "Connected" );  executeStatement(); }); ... Checking the internet a bit more, I found a way to get more insight into the error: ... var  connection =  new  Connection(config);  connection.on( 'connect' ,  function ( err )  {  if (err) return console.error(err);   console .log( "Connected" );  executeStatement(); }); ... That raised: ConnectionError {message: "Failed to connect to 10.0.0.100:1433 - c...

AWS Athena and S3 Partitioning

Athena is a great tool to query your data stored in S3 buckets. To have the best performance and properly organize the files I wanted to use partitioning. Although very common practice, I haven't found a nice and simple tutorial that would explain in detail how to properly store and configure the files in S3 so that I could take full advantage of the Athena partitioning features. After some testing, I managed to figure out how to set it up. This is what I did: Starting from a CSV file with a datetime column, I wanted to create an Athena table, partitioned by date. A basic google search led me to this  page , but It was lacking some more detailing. The biggest catch was to understand how the partitioning works. Based on a datetime column(processeddate), I had to split the date into the year, month and day components to create new derived columns, which in turn I'll use as the partition keys to my table Example of d...

AWS Service Catalog Rule Functions - Cloudformation Fn::Contains Example

I came across an YAML Cloudformation template that was failing validation with the following error: Cannot convert the template because of an error:: unknown tag !<!Contains> at line... The !Contains function is part of AWS Service Catalog, and it is meant to give more control and flexibility when creating your company's stacks. The challenge is that the current AWS Service Catalog documentation only provides examples in JSON format, leaving YAML users at their own luck. Fiddling around in different forums, I happened to notice that YAML can recognize the JSON pattern of the Contains function ( 'Fn::Contains' ) So in order to make the YAML code work, I replaced !Contains with 'Fn::Contains' See the examples below: JSON     "Rules": {         "AuroraDBInstanceTypeRule": {             "RuleCondition": {                 "Fn::Equals": [     ...