# Do I need to use JRuby to access an remote oracle DB with JDBC?

**URL:** <https://rubytalk.org/t/do-i-need-to-use-jruby-to-access-an-remote-oracle-db-with-jdbc/42227>\
**Category:** ruby-talk\
**Created:** [15 November 2007 16:25 UTC](https://rubytalk.org/t/do-i-need-to-use-jruby-to-access-an-remote-oracle-db-with-jdbc/42227 "2007-11-15T16:25:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Larz](https://avatars.discourse-cdn.com/v4/letter/l/85f322/32.png) [@Larz](https://rubytalk.org/u/Larz)\
**Post date:** [15 November 2007 16:25 UTC](https://rubytalk.org/t/do-i-need-to-use-jruby-to-access-an-remote-oracle-db-with-jdbc/42227/1 "2007-11-15T16:25:03Z")

</div>

When I try to connect to a remote oracle DB using activerecord oci8, I  
get the error below.

I can connect with dbvisualizer tool using a JDBC connection. I'm not  
on an officialy sanctioned project and can't really bug the sys admins  
or anyone to configure me something on the remote server. If I want to  
try to connect in ruby using JDBC, I'm guessing I may have to use  
JRuby otherwise it won't work ?

C:\rb-play\>ar\_connect\_ss.rb  
env.c:257:in [oci8lib.so](http://oci8lib.so): ORA-12514: TNS:listener does not currently  
know of serv  
ice requested in connect descriptor (OCIError)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/site\_ruby/1.8/oci8.rb:228:in  
`initialize'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/  
active\_recor  
d/connection\_adapters/oracle\_adapter.rb:585:in `new'

---

<div class="post-metadata">

**Author:** ![Robert\_K1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/robert_k1/32/1830_2.png) [@Robert\_K1](https://rubytalk.org/u/Robert_K1)\
**Post date:** [15 November 2007 17:03 UTC](https://rubytalk.org/t/do-i-need-to-use-jruby-to-access-an-remote-oracle-db-with-jdbc/42227/2 "2007-11-15T17:03:57Z")

</div>

> When I try to connect to a remote oracle DB using activerecord oci8, I  
> get the error below.
> 
> I can connect with dbvisualizer tool using a JDBC connection. I'm not  
> on an officialy sanctioned project and can't really bug the sys admins  
> or anyone to configure me something on the remote server. If I want to  
> try to connect in ruby using JDBC, I'm guessing I may have to use  
> JRuby otherwise it won't work ?

Well, if you want to use JDBC you must be on a JVM. As you probably  
know there are several options (aka programming languages) that will  
work - including but not limited to Java. 🙂

> C:\rb-play\>ar\_connect\_ss.rb  
> env.c:257:in oci8lib.so: ORA-12514: TNS:listener does not currently  
> know of serv  
> ice requested in connect descriptor (OCIError)  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/site\_ruby/1.8/oci8.rb:228:in  
> `initialize'  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/  
> active\_recor  
> d/connection\_adapters/oracle\_adapter.rb:585:in `new'

This might as well be an issue with your local connection  
configuration. Do you have ORACLE\_HOME set appropriately and do you  
have your tnsnames.ora properly edited?

Cheers

robert

> **···**
>
> 2007/11/15, wbsurfver@yahoo.com \<wbsurfver@gmail.com\>:
> 
> --  
> use.inject do |as, often| as.you\_can - without end

---

<div class="post-metadata">

**Author:** ![Xavier\_Noria](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/xavier_noria/32/1867_2.png) [@Xavier\_Noria](https://rubytalk.org/u/Xavier_Noria)\
**Post date:** [15 November 2007 17:12 UTC](https://rubytalk.org/t/do-i-need-to-use-jruby-to-access-an-remote-oracle-db-with-jdbc/42227/3 "2007-11-15T17:12:16Z")

</div>

Probably the Java application is using the thin driver.

If you have the Oracle client installed you need to configure it properly (ORACLE\_HOME, tnsnames.ora). Otherwise JRuby + driver thin is an option, yes.

-- fxn

> **···**
>
> On Nov 15, 2007, at 5:25 PM, wbsurfver@yahoo.com wrote:
> 
> > When I try to connect to a remote oracle DB using activerecord oci8, I  
> > get the error below.
> > 
> > I can connect with dbvisualizer tool using a JDBC connection. I'm not  
> > on an officialy sanctioned project and can't really bug the sys admins  
> > or anyone to configure me something on the remote server. If I want to  
> > try to connect in ruby using JDBC, I'm guessing I may have to use  
> > JRuby otherwise it won't work ?
