On Wed, May 30, 2007 at 10:30:40PM +0900, Peter Bailey wrote:
> I can't seem to get connected to an Oracle server here at my company.
> I'm using the oci8 gem along with DBI. Here's what I code and here's
> what I get. . . .
> 
> require 'oci8'
> require 'dbi'
> 
> begin
> # connect to the Oracle server
> dbh =
> 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')
=> #<OCI8:0xb6b3fb00 @privilege=nil, @svc=#<OCISvcCtx:0xb6b3fab0>, @ctx=[0, #<Mutex:0xb6b3fac4 @locked=false, @waiting=[]>, 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')
=> #<OCI8:0xb6b3b5dc @privilege=nil, @svc=#<OCISvcCtx:0xb6b3b58c>, @ctx=[0, #<Mutex:0xb6b3b5a0 @locked=false, @waiting=[]>, 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.