Hi,

I have an application consisting of a web application and some stand
alone java clients. Both the web application and the java clients use a
database. The problem is that the database configuration is duplicated.

When I change the database settings, I have to reconfigure both the
webapp (META-INF/context.xml) and the java clients
(mydatabasesettings.properties).

I'd like to avoid this duplication. One possible solution would be to
generate the context.xml based on mydatabasesettings.properties with an
Ant script. Are there any better solutions?

I'd like to keep using Tomcat's connection pooling with the web app.


web application
===============
Database configuration:
  META-INF/context.xml.
Code:
  Context ctx = (Context) new InitialContext().lookup("java:comp/env");
  DataSource  ds = (DataSource) ctx.lookup("mydbpool");
  Connection = ds.getConnection();

java client
===========
Database configuration:
  mydatabasesettings.properties
Code:
  SybDataSource ds = new com.sybase.jdbc2.jdbc.SybDataSource();
  ds.setServerName(this.dbServer);
  // more configuration...
  Connection = ds.getConnection();

-Tomas

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to