Connect ruby to Oracle in Ubuntu

Source: Internet
Author: User
This is the operation procedure in Ubuntu. It will be different in other Linux systems, and the principle is similar in general. Upload 1 download ruby-oci8's latest stable version of ruby-oci8-1.0.2.tar.gz 2 install Oracle-xe-client3 first install ruby3 set environment variables, you can set in/etc/environment, you can also set in ~ /. ORACLE_HOME = "/usr/lib/oracle in bashrc

This is the operation procedure in Ubuntu. It will be different in other Linux systems, and the principle is similar in general.

Preparation

1 download ruby-oci8's latest stable version ruby-oci8-1.0.2.tar.gz
2 install Oracle-xe-client first
3 install ruby first

3. Set environment variables in/etc/environment or ~ /. Bashrc

ORACLE_HOME = "/usr/lib/oracle/xe/app/oracle/product/10.2.0/client"
LD_LIBRARY_PATH = "$ ORACLE_HOME/lib: $ LD_LIBRARY_PATH"

Note: It seems that LD_LIBRARY_PATH is not set as long as there is oracle-home.

Compile and install
Cd [Download Directory]
Tar-zxvf ruby-oci8-1.0.2.tar.gz
Cd ruby-oci8-1.0.2
Make
Make install

Test
Connect to oracle

Ruby-r oci8-e "OCI8.new ('Scott ', 'tiger', 'xe'cmd.exe c ('select sysdate from dual') do | r | puts r. join (','); end"

Change scott, tiger, and xe to your username, password, and connection Instance name, similar to sqlplus scott/tiger @ xe;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.