From: Peter Bailey Date: 2007-05-30T23:12:02+09:00 Subject: Re: Help with Ruby < - > Oracle Connectivity Brian Candler wrote: > On Wed, May 30, 2007 at 10:30:40PM +0900, Peter Bailey wrote: >> DBI.connect("DBI:OCI8:ORCL:graphicsdb-prod.bna.com/grpprod.bna.com", >> "user", "passw") >> ... > > Check your tnsnames.ora file. > > If you are using oracle-instantclient library and > ruby-oci8-1.0.0-rc1/rc2, > then you are allowed to use "//hostname/dbname" as the connect string. > Otherwise you must use a database name which matches an entry in > tnsnames.ora > > I don't use DBI, but here are some ruby-oci8 examples which work for me: > > $ irb1.8 > irb(main):001:0> require 'oci8' > => true > irb(main):002:0> c = OCI8.new('candlerb','XXXXXXXX','dcfgdb') > => #, > @ctx=[0, #, nil, 65535], > @prefetch_rows=nil> > irb(main):003:0> > > where /etc/tnsnames.ora contains: > > DCFGDB = > (DESCRIPTION = > (ADDRESS = (PROTOCOL = TCP)(HOST = db.example.com)(PORT = 1521)) > (CONNECT_DATA = > (SERVER = DEDICATED) > (SERVICE_NAME = DCFGDB) > ) > ) > > Alternatively, > > irb(main):003:0> c = > OCI8.new('candlerb','XXXXXXXX','//db.example.com/dcfgdb') > => #, > @ctx=[0, #, nil, 65535], > @prefetch_rows=nil> > irb(main):004:0> > > because I'm using oracle-instantclient. > > If you can get these direct oci8 examples to work, you should find it > easier > to make a DBI connect string which works. > > HTH, > > Brian. Thanks, Brian. I had one of our company DBA guys come down and installed the Oracle 10g client on my server, so, I don't know whether or not it's the "instant client," but I think not. I know that I'm able to use and connect with my database using SQLPlus, which came with the client. My "tnsnames.ora" file shows this: ... (ADDRESS = (PROTOCOL = TCP)(HOST = graphicsdb-prod.bna.com)(PORT = 1521)) ... I'm using DBI here, but, I'm ignorant. I don't know whether I need to use it or not. It's all I've found in googling around to do this. But, anyway, nothing you suggest is working for me. -Peter -- Posted via http://www.ruby-forum.com/.