All of a sudden, on three different systems, the "server_ip_address/sid_name" syntax in database.yml has stopped working for me. I can''t even do a OCI8.new(blah blah blah) statement from an IRB shell. I get "ORA-12541: TNS:no listener", or some variant, depending on how I phrase it. On systems where I have a real deal client installed, and OCI can find the tnsnames file, I can still connect using the sid name by itself. Did something change? I''ve tried it with the trunk and 0.13.1. Thanks, --Wilson. irb(main):001:0> require ''oci8'' => true irb(main):002:0> conn = OCI8.new("user", "secret", "192.168.0.100/kiddev") OCIError: ORA-12154: TNS:could not resolve service name from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `attach'' from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `initialize'' from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `do_ocicall'' from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `initialize'' from (irb):2:in `new'' from (irb):2 irb(main):003:0> irb(main):003:0> conn = OCI8.new("user", "secret", "kiddev") => #<OCI8:0x2c37b88 @srv=#<OCIServer:0x2c37b40>, @auth=#<OCISession:0x2c37b28>, @svc=#<OCISvcCtx:0x2c37b58>, @ctx=[0, #<Mutex:0x2c37af8 @locked=false, @waiting[]>, nil]>
Well, I never did get the HOST_NAME/SID pattern to work again.. but just in case anyone else has this problem, I did this: development: adapter: oci host: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.123)(PORT = 1523)) ) (CONNECT_DATA = (SID = database_thingy) (SERVER = DEDICATED) ) ) username: user password: supersecret Basically, a full TNSNAMES style connection string on a single line. Is that a real deal option? If so, should I add it to the Wiki? Thanks, --Wilson. Wilson wrote:> All of a sudden, on three different systems, the > "server_ip_address/sid_name" syntax in database.yml has stopped working > for me. > I can''t even do a OCI8.new(blah blah blah) statement from an IRB shell. > I get "ORA-12541: TNS:no listener", or some variant, depending on how I > phrase it. > On systems where I have a real deal client installed, and OCI can find > the tnsnames file, I can still connect using the sid name by itself. > > Did something change? I''ve tried it with the trunk and 0.13.1. > > Thanks, > --Wilson. > > irb(main):001:0> require ''oci8'' > => true > irb(main):002:0> conn = OCI8.new("user", "secret", "192.168.0.100/kiddev") > OCIError: ORA-12154: TNS:could not resolve service name > from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `attach'' > from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `initialize'' > from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `do_ocicall'' > from c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:156:in `initialize'' > from (irb):2:in `new'' > from (irb):2 > irb(main):003:0> > > irb(main):003:0> conn = OCI8.new("user", "secret", "kiddev") > => #<OCI8:0x2c37b88 @srv=#<OCIServer:0x2c37b40>, > @auth=#<OCISession:0x2c37b28>, @svc=#<OCISvcCtx:0x2c37b58>, @ctx=[0, > #<Mutex:0x2c37af8 @locked=false, @waiting> []>, nil]> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I never had problems connecting to Oracle provided that: - I include (replace with your Oracle client path) in environment.rb. The PATH varibale should certainly be replaced with LD_LIBRARY_PATH under Linux and should point to the OCI shared library directory. ENV[''PATH''] = ''C:\instantclient10_1'' ENV[''ORACLE_HOME''] = ''C:\instantclient10_1'' - I have a proper tnsnames.ora file in ORACLE_HOME/network/admin containing the connection data for my database. For example: MYDB (DESCRIPTION (ADDRESS_LIST (ADDRESS = (PROTOCOL = TCP)(HOST = dbhost)(PORT = 1521)) ) (CONNECT_DATA (SID = mydbsid) (SERVER = DEDICATED) ) ) - I reference the TNS name defined in tnsnames.ora simultaneously in database and host entries in my database.yml. For example: development: adapter: oci database: mydb host: mydb username: myuser password: topsecret Julien -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Wilson Sent: Thursday, July 28, 2005 2:43 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] Oracle OCI8, or "am I going crazy?" Well, I never did get the HOST_NAME/SID pattern to work again.. but just in case anyone else has this problem, I did this: development: adapter: oci host: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.123)(PORT = 1523)) ) (CONNECT_DATA = (SID database_thingy) (SERVER = DEDICATED) ) ) username: user password: supersecret Basically, a full TNSNAMES style connection string on a single line. Is that a real deal option? If so, should I add it to the Wiki? Thanks, --Wilson.
Wilson <defiler-ifvz4xmYPRU@public.gmane.org> writes:> Well, I never did get the HOST_NAME/SID pattern to work again.. but just in case > anyone else has this problem, I did this:If you use Oracle Instant Client, use //HOST_NAME/SID instead of HOST_NAME/SID.> development: > adapter: oci > host: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = > 192.168.0.123)(PORT = 1523)) ) (CONNECT_DATA = (SID = database_thingy) (SERVER > = DEDICATED) ) ) > username: user > password: supersecret > > Basically, a full TNSNAMES style connection string on a single line. > Is that a real deal option? If so, should I add it to the Wiki?Yes but only for Oracle Instant Client. http://www.oracle.com/technology/tech/oci/instantclient/ic-faq.html#A4428 We need tnsnames.ora for full Oracle Client.> Thanks, > --Wilson.-- KUBO Takehiro email: kubo-MPg98oU6eI0dnm+yROfE0A@public.gmane.org web: http://www.jiubao.org GnuPG fingerprint = 5F7B C8EF CA16 57D0 FDE1 9F47 C001 1F93 AC08 2262
My production box is running on the Instant Client, development is using the ''full'' 9i client. Even on the instant client, I couldn''t make the double-slash format work. e.g. host: //rails.example.com/railsdb ..where railsdb is the actual name of the instance, not a reference in any TNSNAMES file anywhere on the system. Is that intended to work? Any special environment variables required for that form? Thanks, --Wilson. KUBO Takehiro wrote:> Wilson <defiler-ifvz4xmYPRU@public.gmane.org> writes: > > >>Well, I never did get the HOST_NAME/SID pattern to work again.. but just in case >>anyone else has this problem, I did this: > > > If you use Oracle Instant Client, use //HOST_NAME/SID instead of HOST_NAME/SID. > > >>development: >> adapter: oci >> host: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = >>192.168.0.123)(PORT = 1523)) ) (CONNECT_DATA = (SID = database_thingy) (SERVER >>= DEDICATED) ) ) >> username: user >> password: supersecret >> >>Basically, a full TNSNAMES style connection string on a single line. >>Is that a real deal option? If so, should I add it to the Wiki? > > > Yes but only for Oracle Instant Client. > http://www.oracle.com/technology/tech/oci/instantclient/ic-faq.html#A4428 > > We need tnsnames.ora for full Oracle Client. > > >>Thanks, >>--Wilson. > >
Wilson <defiler-ifvz4xmYPRU@public.gmane.org> writes:> My production box is running on the Instant Client, development is using the > ''full'' 9i client.Does Rails use the Instant Client or the ''full'' 9i client?> Even on the instant client, I couldn''t make the double-slash format work. > e.g. host: //rails.example.com/railsdb > ..where railsdb is the actual name of the instance, not a reference in any > TNSNAMES file anywhere on the system. Is that intended to work? > Any special environment variables required for that form?Hmm.>>> host: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = >>>192.168.0.123)(PORT = 1523)) ) (CONNECT_DATA = (SID = database_thingy) (SERVER >>>= DEDICATED) ) )The default listener port is 1521, but your listener runs on 1523. How about //HOST:PORT/SID. host: //192.168.0.123:1523/database_thingy>>>Basically, a full TNSNAMES style connection string on a single line. >>>Is that a real deal option? If so, should I add it to the Wiki?(skip)>> We need tnsnames.ora for full Oracle Client.Sorry. A full TNSNAMES style connection string works on the full Oracle Client (Oracle 9.2.0.1.0 on Linux). But I couldn''t find any documents noticing it. I won''t use it on my product. -- KUBO Takehiro email: kubo-MPg98oU6eI0dnm+yROfE0A@public.gmane.org web: http://www.jiubao.org GnuPG fingerprint = 5F7B C8EF CA16 57D0 FDE1 9F47 C001 1F93 AC08 2262
Works fine for me - has done so for weeks without so much as a reboot. Win XP, Oracle 10g "normal" (i.e. not instant) client, talking to both Oracle 8i and 10g databases. database.yml content looks like development: adapter: oci database: <<TNS database name>> host: <<TNS database name>> username: ****** password: ****** Regards Dave M. On 7/29/05, KUBO Takehiro <kubo-MPg98oU6eI0dnm+yROfE0A@public.gmane.org> wrote:> Wilson <defiler-ifvz4xmYPRU@public.gmane.org> writes: > > > My production box is running on the Instant Client, development is using the > > ''full'' 9i client. > > Does Rails use the Instant Client or the ''full'' 9i client? > > > Even on the instant client, I couldn''t make the double-slash format work. > > e.g. host: //rails.example.com/railsdb > > ..where railsdb is the actual name of the instance, not a reference in any > > TNSNAMES file anywhere on the system. Is that intended to work? > > Any special environment variables required for that form? > > Hmm. > > >>> host: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST > >>>192.168.0.123)(PORT = 1523)) ) (CONNECT_DATA = (SID = database_thingy) (SERVER > >>>= DEDICATED) ) ) > > The default listener port is 1521, but your listener runs on 1523. > > How about //HOST:PORT/SID. > host: //192.168.0.123:1523/database_thingy > > >>>Basically, a full TNSNAMES style connection string on a single line. > >>>Is that a real deal option? If so, should I add it to the Wiki? > (skip) > >> We need tnsnames.ora for full Oracle Client. > > Sorry. A full TNSNAMES style connection string works on the full > Oracle Client (Oracle 9.2.0.1.0 on Linux). But I couldn''t find any > documents noticing it. I won''t use it on my product. > > -- > KUBO Takehiro > email: kubo-MPg98oU6eI0dnm+yROfE0A@public.gmane.org > web: http://www.jiubao.org > GnuPG fingerprint = 5F7B C8EF CA16 57D0 FDE1 9F47 C001 1F93 AC08 2262 > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
As I stated previously, you can use tnsnames.ora with instantclient. Simply define ORACLE_HOME and create a tnsnames.ora file under $ORACLE_HOME/network/admin (you will have to create those directories). ORACLE_HOME can be anywhere you want. -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of David Mitchell Sent: Friday, July 29, 2005 2:42 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] Oracle OCI8, or "am I going crazy?" Works fine for me - has done so for weeks without so much as a reboot. Win XP, Oracle 10g "normal" (i.e. not instant) client, talking to both Oracle 8i and 10g databases. database.yml content looks like development: adapter: oci database: <<TNS database name>> host: <<TNS database name>> username: ****** password: ****** Regards Dave M. On 7/29/05, KUBO Takehiro <kubo-MPg98oU6eI0dnm+yROfE0A@public.gmane.org> wrote:> Wilson <defiler-ifvz4xmYPRU@public.gmane.org> writes: > > > My production box is running on the Instant Client, development is > > using the ''full'' 9i client. > > Does Rails use the Instant Client or the ''full'' 9i client? > > > Even on the instant client, I couldn''t make the double-slash formatwork.> > e.g. host: //rails.example.com/railsdb ..where railsdb is the actual> > name of the instance, not a reference in any TNSNAMES file anywhere > > on the system. Is that intended to work? > > Any special environment variables required for that form? > > Hmm. > > >>> host: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = > >>>TCP)(HOST = 192.168.0.123)(PORT = 1523)) ) (CONNECT_DATA = (SID > >>>database_thingy) (SERVER = DEDICATED) ) ) > > The default listener port is 1521, but your listener runs on 1523. > > How about //HOST:PORT/SID. > host: //192.168.0.123:1523/database_thingy > > >>>Basically, a full TNSNAMES style connection string on a singleline.> >>>Is that a real deal option? If so, should I add it to the Wiki? > (skip) > >> We need tnsnames.ora for full Oracle Client. > > Sorry. A full TNSNAMES style connection string works on the full > Oracle Client (Oracle 9.2.0.1.0 on Linux). But I couldn''t find any > documents noticing it. I won''t use it on my product. > > -- > KUBO Takehiro > email: kubo-MPg98oU6eI0dnm+yROfE0A@public.gmane.org > web: http://www.jiubao.org > GnuPG fingerprint = 5F7B C8EF CA16 57D0 FDE1 9F47 C001 1F93 AC08 2262> _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails