03 Jul 2010, 14:17
Generic-user-small

Bharat Ruparel (146 posts)

you write:

It’s also possible to fetch your database connection from JNDI.2 You do
this by providing a parameter named jndi, which has the name of the
JNDI object to get the database connection from. If you do that, you
can leave out most of the other parameters:
Download databases/jndi_connect.rb
ActiveRecord::Base.establish_connection(
:adapter => ‘jdbc’ ,
:jndi => ‘jdbc/using_jruby’ ,
:driver => ‘com.mysql.jdbc.Driver’ ,
)

Again show a working example. This example will not work outside of a properly configured container environment with JNDI service available which you say nothing about. If it is too much to provide a container example configured with JNDI then you can move it to an appendix section where someone can refer to it if interested.

Bharat

06 Jul 2010, 15:25
Mr_sketchy_pragsmall

Ian Dees (192 posts)

Hi, Bharat.

I believe the thought behind this example was that readers of this section who want JNDI support already have a JNDI environment set up, and are just looking for the right syntax to point their JRuby code towards it. It may be beyond the scope of the database chapter to get into the details of JNDI setup.

But you’re right: we need to do something for the reader. We’ll add a link to information on setting up JNDI. Thanks for pointing this out.

Sincerely,

Ian

  You must be logged in to comment