How to Use R Language to Connect with an ORACLE Database
The language R can be used to connect with an ORACLE database and perform several actions. For use on Linux Ubuntu and ORACLE XE, learning to connect in this way makes the task much more manageable. Choose your OS (Linux 32) here:...
Method 1 of 5:
Instant Client + ODBC packages
-
How to Use R Language to Connect with an ORACLE Database Picture 1
Choose your OS (Linux 32) here:http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html -
How to Use R Language to Connect with an ORACLE Database Picture 2
Accept the License Agreement and agree to download:-
- Instant Client Package - Basic
- Instant Client Package - ODBC
-
-
How to Use R Language to Connect with an ORACLE Database Picture 3
Unzip both packages in the same directory. For example, /home/sven/instantclient_11_2
Method 2 of 5:
Unixodbc
-
How to Use R Language to Connect with an ORACLE Database Picture 4
Download unixodbc from here: http://www.unixodbc.org/download.html. -
How to Use R Language to Connect with an ORACLE Database Picture 5
Install it.
Method 3 of 5:
Edit odbc.ini & odbcinst.ini
-
How to Use R Language to Connect with an ORACLE Database Picture 6
Find the two .ini files. These are located in /etc/ (Ubuntu). Perhaps there are similar files in other locations; if so, it's recommended that you delete them. -
How to Use R Language to Connect with an ORACLE Database Picture 7
Add a new entry like this:- For odbc.ini ...
- [ORACLE2]
- Driver = ORACLE2
- ServerName = 143.93.91.33:1521/xe
- UserID = your_username
- Password = xxx
- METADATA_ID = 0
- ENABLE_USER_CATALOG = 1
- ENABLE_SYNONYMS = 1
- For odbcinst.ini ...
- [ORACLE2]
- Description = oracle driver
- Driver = /home/sven/instantclient_11_2/libsqora.so.11.1
- DontDLClose = 1
- FileUsage = 1
- UsageCount = 1
- Notes: 'Driver' points at the file 'libsqora.so.11.1' in the Instant-client location.
Method 4 of 5:
Add to your path
-
How to Use R Language to Connect with an ORACLE Database Picture 8
You may need to add 2 entries to your path (example):- export OCI_LIB=/home/sven/instantclient_11_2
How to Use R Language to Connect with an ORACLE Database Picture 9
- export LD_LIBRARY_PATH=/home/sven/instantclient_11_2
- export OCI_LIB=/home/sven/instantclient_11_2

Method 5 of 5:
The R language
-
How to Use R Language to Connect with an ORACLE Database Picture 11
Obtain a package called 'RODBC' in order to connect with the database. Download it here: http://cran.r-project.org/web/packages/RODBC/index.html -
How to Use R Language to Connect with an ORACLE Database Picture 12
Start R, switch to the location which contains the RODBC package and an enter the following R code:- install.packages(packagename.tar.gz)
-
How to Use R Language to Connect with an ORACLE Database Picture 13
After the package installation you can create a channel:- ch=odbcConnect("ORACLE2")
- Check the channel with odbcGetInfo(ch)
- If the connection was successful, the console shows something like this:
- odbcGetInfo(ch)
- DBMS_Name DBMS_Ver Driver_ODBC_Ver
- "Oracle" "10.02.0010" "03.52"
- Data_Source_Name Driver_Name Driver_Ver
- "ORACLE2" "SQORA32.DLL" "11.02.0001"
- ODBC_Ver Server_Name
- "03.52" "143.93.91.33:1521/xe"
4.3 ★ | 3 Vote
You should read it
- 5 best torrent clients for Windows
- Method in HTTP
- Use Nautilus as FTP Client
- Instructions for registering V90 package is only 90k to receive the super 3-in-1 integration right away
- Package in Python
- How to check Internet package network FPT, VNPT, Viettel are using
- How to use winget - New Package Manager for Windows 10
- Learn about the ISA Firewall Client (Part 1)
- What is a package dependency in Linux?
- Exciting with World Cup MobiFone launched a great data package
- DNSCrypt client for Windows: Encrypt data from computer to DNS
- How to register for Mobile Interphone package of Mobifone