I try to connect to an oracle DB using Rstudio, but I can't figure out how to do it. I have connected to the database with PowerBi, so I know it is accessible (from my pc/ip) and that the database works fine, however using R I cannot get this done. Prior to asking this question I have been searching the web for days, I'm not new to R or SQL, but I am to Oracle. I have tried various packages (DBI, odbc, RODBC etc.) but still no success. I have talked to the administrators of the DB, they said I should be able to connect using the following information which is provided to me;
Server: xxx.xxx.xx.xx
Port : xxxx
Instance : ORCL
User: myusername
Pwd : mypwd
When I connect to the DB using PowerBI, my server name is: server/instance, in combination with the uid and pwd the connection than works fine.
The closest I (think I) got, was using the 'odbcDriverConnect()' function. First I ran the following command to check which drivers are installed;
sort(unique(odbcListDrivers()[[1]]))
which gave as output
"Oracle in OraClient12Home1" "Oracle in OraClient12Home2" "SQL Server"
Other topics here on stackoverflow, suggested the following site to check which string to use in the function:
https://www.connectionstrings.com/oracle/
I couldn't find a specific one for my listed drivers, but I altered the one for the Oracle in OraClient11g_home1 since it seemed to be the best match, this string is as follows;
Driver={Oracle in OraClient11g_home1};Server=serverSID;Uid=myUsername; Pwd=myPassword;
So I replaced the Oracle in OraClient11g_home1 with my drivers, they all gave another error;
con <- odbcDriverConnect("Driver={Oracle in OraClient12Home1};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;")
Warning messages:
1: In odbcDriverConnect("Driver={Oracle in OraClient12Home1};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;") :
[RODBC] ERROR: state IM003, code 160, message Het opgegeven stuurprogramma kan niet worden geladen vanwege een systeemfout 126: Kan opgegeven module niet vinden. (Oracle in OraClient12Home1, C:\Program Files\Oracle\product\12.2.0\client_1\SQORA32.DLL).
2: In odbcDriverConnect("Driver={Oracle in OraClient12Home1};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;") :
ODBC connection failed
The error is in Dutch, stating that the driver cannot be found due to systemerror 126
the next driver gives another error;
con <- odbcDriverConnect("Driver={Oracle in OraClient12Home2};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;")
Warning messages:
1: In odbcDriverConnect("Driver={Oracle in OraClient12Home2};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;") :
[RODBC] ERROR: state HY000, code 12560, message [Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error
2: In odbcDriverConnect("Driver={Oracle in OraClient12Home2};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;") :
ODBC connection failed
The last driver, is the only one who takes a few seconds, suggesting its actually trying to connect, but eventually also gives an (other) error;
con <- odbcDriverConnect("Driver={SQL Server};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;")
Warning messages:
1: In odbcDriverConnect("Driver={SQL Server};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;") :
[RODBC] ERROR: state 08001, code 17, message [Microsoft][ODBC SQL Server Driver][DBNETLIB]De SQL-server bestaat niet of de toegang tot de server is geweigerd.
2: In odbcDriverConnect("Driver={SQL Server};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;") :
[RODBC] ERROR: state 01000, code 53, message [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).
3: In odbcDriverConnect("Driver={SQL Server};Server=xxx.xxx.xx.xx/orcl;Uid=xxx;Pwd=xxx;") :
Stating that the server doesn't exists or that the acces is denied. Once again, I know it exists and that I am granted access because it works on powerBi, so I am kind off lost right now. I have tried the server with and without the /orcl. If anyone has any clue on what I am missing that would be greatly appreciated!
Kind regards
