It's always a battle getting anything non-Java to connect to Oracle, I've 
found. I've used a couple other languages to connect to Oracle, but never 
Ruby. However, the steps are more or less the same.

Largely, follow the steps that Adam has laid out. You absolutely must have 
ORACLE_HOME defined. You probably need LD_LIBRARY_PATH defined (although I 
think it is DYLD_LIBRARY_PATH on a Mac) unless the Oracle clients are in 
your library path. They aren't by default but most of my know-how refers to 
the Redhat Oracle RPMs. You only need TNS_ADMIN defined if you plan on 
putting your connection strings in a tnsnames.ora file. I typically do not 
do that, but that's an option. If you have really complex connection 
strings with failovers, load balancing, or the like then this is a good 
option but if you are connecting using just hostname and service name (or 
SID), then don't bother.

Once everything is setup, test your connection with:

$ORACLE_HOME/bin/sqlplus user/pass@//hostname/servicename

If that works, you should be good to go with the oci8 libraries. If you 
need to connect with a web server (eg. rails) then the environment 
variables will need to be defined for the web server.



On Monday, May 13, 2013 10:02:09 PM UTC-7, Gisborne wrote:
>
> The warning: unless you’re going to make a career of it, run screaming 
> from any suggestion that you install and configure Oracle. I set up 
> Postgres and MySQL regularly. You’d think that would help, but NOOO.
>
> The suggestion: if you *must* install and set up Oracle, it is somewhat 
> less scream-inducing to do it on Windows than on Linux.
>
> The question: now how do I connect to it? The only way I’ve gotten to work 
> is from DOS:
>
> sqlplus <user>@<database>
>
>
> This comes back:
>
> ORA-12154: TNS:could not resolve the connect identifier specified
>
> at which point it asks me to enter user name and password. The <user> I 
> just entered above and its password then work fine.
>
> I can’t do this either:
>
> sqlplus <user>/<password>@<database>
>
> What I *really* need is to connect from IRB on my Mac. I have oci8 gem 
> installed.
>
> The amount of subtly and grossly different advice I get when I try to 
> google this issue is truly astounding: listener.ora, tnsnames.ora, 
> connection strings, setting environment variables, using various Oracle 
> utilities (many of which I don’t appear to have), and every one advises me 
> to do something slightly different, and assumes I understand some other 
> thing that’s just as confusing.
>
> Does anyone here have experience with this situation who might advise me?
>

-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to