Re: Avoid duplication of database settings
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. If you are doing it the ant way I recommend using filtering. Thanks for the suggestion. I will have a look at it. Do you know if frameworks like Spring or Hibernate solves this kind of problems? -Tomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Avoid duplication of database settings
Sorry about the antispammed subject in my previous post. 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. If you are doing it the ant way I recommend using filtering. Thanks for the suggestion. I will have a look at it. Do you know if frameworks like Spring or Hibernate solves this kind of problems? I don't know about spring but in hibernate there is one configuration file that you can share between webapp and standalone clients. (Using it in my current project.) If you only use Hibernate to access your database you will be fine. It is also possible to get the DataSource from the hibernate configuration if you want to access the database directly (for performance reasons). I have some SQL scripts that need the database info so I use filtering anyway both as a way to have the configuration values in one place and as a way to easily build for different environments. Regards, Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Avoid duplication of database settings
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]
RE: [SPAM] - Avoid duplication of database settings - Number of numbers in MIME From exceeds maximum threshold
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? If you are doing it the ant way I recommend using filtering. There is a task called filter (see http://ant.apache.org/manual/CoreTasks/filter.html). You put the values you want to use at several places in its own property file for example dbname=mydb, in the places you want to insert it you go @dbname@ instead of the actual name. When you run the filter task all values in the filter property file is put in its correct places. (I use this now to build for different environments. One property file for development, one for test and one for production. But in you case you onle need on file I guess.) If you are using Maven there is some more support for filtering although the ant task still needs to be called explicilty. Regards, Fredrik Rubensson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]