Jindi configuration some clarification

I’m using jruby for my rails applications.
I create war files with warbler and deploy under tomcat.
My jindi connections don’t work.
In https://gist.github.com/1564440 th configuration reported is:

adapter: jdbc
jndi: java:comp/env/jdbc/your_jndi_name
driver: postgresql
encoding: utf8
wait_timeout: 5
pool: 5

Is said to rename production section in production_jdbc and jndi
parameter is set to java:comp/env/jdbc/your_jndi_name.
Other docs says for jndi parameter: jndi: jdbc/your_jndi_name.
I don’t undestand what does it mean comp/env/jdbc.
In addition:
It is still necessary in rails 3.2.9 to include this piece of code to
close connections?


if defined?($servlet_context)
require ‘action_controller/dispatcher’
ActionController::Dispatcher.after_dispatch do