Hi All, I think the problem can be resolved by creating the temporary directory, anyother directory which location can be "hard-wired as initial parameter in the web.xml file". But where in my application's web.xml I have to "hard-wire" this directory. Can you please let me exactly where should I "hard-wire" this directory so that my application can dynamically create the "properties file" inside this directory.
Thanks, Vikas Nagpal. --- Hadraba Petr <[EMAIL PROTECTED]> wrote: > Hi Vikas, > > some details: > > I see you're correctly using the > getClass.getResource() (I'm using > getServletContext().getResourceAsStream() or > getServletContext().getResource()). But, Why are you > creating > resources? You see all the war content in the host > OS filesystem > because of unpackWars="true". This is because of > performance (I hope) > and if you set this to "false", Tomcat will *read* > resources (also > classes and anything else) from the WAR file > directly! You are mixing > two things together: one are resources (they are > using URL instead of > File) and on the other side Host OS FileSystem (the > File objects). > > So, you store database connection parameters in the > property file. I > see two options to solve your problem: > 1. Move the property file outside the resources if > you want dynamic > creation. For example: temporary directory, any > other directory which > location can be "hard-wired as initial parameter in > the web.xml file". > 2. Use Tomcat's database pooler. You give more > performence (if you're > not using "your own" database connection pooler)! > > > Please explain what you want to do, what's your > goal... > > Have a nice day > > PETR > > > On 4/21/06, VIKASS NAGPAL <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > I have a problem here. I have Pproperties file. > > It has the following code: > > > > File f = new File(propertyFolder); > > > > if (!f.exists()) f.mkdir(); > > > > f = new File(propertyFolder + > > System.getProperty("file.separator") + > > propertyFileName); > > > > if (!f.exists()) > > { > > String s = ((this.getClass().getResource("/" + > > propertyFileName)).toString()); > > > > File pf = new File(s.substring(6)); > > > > This code creates a folder with the name > > propertiespaydir and file with the name > > pdr.properties. In order to connect to the > database i > > have to read the Servername, Database name, > Username > > and password from this file or creates a file with > the > > name pdr.properties file. But If i rename this > > pdr.properties file to something else then my code > > does not create the file with the name > pdr.properties. > > So I cannot connect to the database. So anyone of > you > > knows what change should i make into my existing > code > > in order for me to create the file with the name > > pdr.properties in case it does not exist. I would > > really be thankful for any help in this matter. > > > > Thanks, > > With regards, > > Vikas Nagpal. > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > -- > Petr Hadraba > graphic artist and software designer > http://people.hadraba-soft.com/~petr > hadrabap AT bluetone DOT cz > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]