I am using the Oracle SQL developer to do some work: extract data to CSV files and then analyze the data in R. I want to automate this, using R to do the querys and the analysis.
I have used R to connect to other databases: SQL server, MySQL, Postgres, but I am finding a lot of complexities to connect it to Oracle.
So, I want to connect to an Oracle 11g database from R in windows. I tried RODBC, but first I have to setting the ODBC following this instructions:
How do I connect to an Oracle Database in R?
The DBA give to me the following: UserId, Password, Host, Port and SID
In the “Oracle ODBC Driver Configuration” window I write the following:
Data Source Name: SID
Description: Oracle ODBC
TNS Service Name: host:port/SID
UserID: UserId
But I receive this error:
Unable to connect
SQLState = S1000
[Oracle]{ODBC][Ora]ORA-12514: TSN:listener does not currently know of service
requested in connect descriptor
So, my question is: How I can connect to Oracle from R? Is there another way? What I am doing wrong?
Thanks in advance…
I connect to Oracle using RODBC quite often at work. Using Windows, I setup an ODBC connection to the DB prior to connecting from within R. This allows you to check your connection first.
After you are all set, I then connect with a command like this:
This creates a channel to the Oracle Database.
Hope that helps