Ingo Siebert wrote:
JNDI is an additional complexity to my app. It feels wrong to use JNDI
only to get a simple file path or a base file path.
I primary configuration values are many but simple string values like
a JDBC-URL or JDBC-Options. I think the complete abstraction of the
DataSource is not necessary for me.
I'll argue whether JNDI is a complexity. IMO it's more complex to have
custom code to deal with opening database connection, than to retrieve
datasource from JNDI.
In most cases you'll need just the following to obtain db connection:
Context initContext = new InitialContext();
DataSource ds = (DataSource)initContext.lookup("java:/comp/env/jdbc/db");
Connection conn = ds.getConnection();
No need to know jdbc driver and other options. Everything is set up on
container level.
If I want to deploy my web app to another container like tomcat, does
all container provide JNDI and are all containers compatible? I have
no experience with that, but it's an possible cause of defect.
Do you think I can safely use JNDI and never get any problem?
It's a standard. It'll work. The way you configure JNDI depends on
container, but from the application side there will be no changes at all.
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html
--
Mikolaj Rydzewski <[EMAIL PROTECTED]>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]