« Return to Thread: Forward: From Rich Manalang on Oracle w/ JNDI configuration question

Re: Forward: From Rich Manalang on Oracle w/ JNDI configuration question

by kofno :: Rate this Message:

Reply to Author | View in Thread

The driver line "should" be optional. It's there to make sure the right flavor of SQL is generated. We try to do our best to find what driver is actually being used by the JNDI datasource, but that code hasn't been thoroughly tested.

On Feb 7, 2008 4:18 PM, Thomas E Enebo <tom.enebo@...> wrote:
We are having an issue with subscribing to our mailing lists (which I
have reported).  Here is an email from Rich:

Has anyone had any success with using jndi connection pools using
JRuby 1.1RC1/activerecord-jdbc-0.7.1 on Oracle?  I followed the
instructions on the JRuby wiki
(http://wiki.jruby.org/wiki/Goldspike#Using_a_connection_from_a_pool_via_JNDI)
and when that didn't work, I tried several variations.


Here's how I currently have this configured:

database.yml:

development:
 adapter: jdbc
  jndi: java:comp/env/jdbc/mydb
 driver: oracle.jdbc.driver.OracleDriver

I've also tried this:

development:
  adapter: jdbc
  jndi: jdbc/mydb
  driver: oracle.jdbc.driver.OracleDriver

I get an exception with these two configurations -> jdbc_adapter.rb
(line 303) throws "Failed to load Rails: The driver encountered an
error: java.lang.NullPointerException: null"

I've also tried this (this is how it's specified on the JRuby wiki...
I get a "can't find oracle driver" exception with this):

development:
  adapter: jdbc
  jndi: java:comp/env/jdbc/mydb
  driver: oracle.jdbc.driver.OracleDriver

I've also tried excluding the driver attribute, but get this exception:

"Failed to load Rails: The driver encountered an error: can't convert
nil into String" -- jdbc_adapter.rb (line 303)

My web.xml has the following in it:

...
   <resource-ref>
     <res-ref-name>jdbc/mydb</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
    </resource-ref>
...

And... I've configured my container (Oracle app server, aka, OC4J
10.3) with the requisite data source and connection pool
configurations and tested that I can connect to them.

One thing I'm not clear on is why the driver has to be specified in
the database.yml if it's a jndi resource.  I'm going to try this on
Jetty to see if it's a container issue, but if anyone out there know's
what I'm doing wrong, please let me know.

Thanks.

Rich Manalang
https://mix.oracle.com


--
Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: enebo@... , tom.enebo@...

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Ryan L. Bell
http://kofno.wordpress.com
http://kofno.blogspot.com

 « Return to Thread: Forward: From Rich Manalang on Oracle w/ JNDI configuration question