Thanks for your response Mark! Maybe I should have started off stating that I don't quite understand what is going on as I'm using a class that isn't a servlet.
This class - DatabaseUtils - contains some common methods I use, one of them being makeDatabaseConnection()...which returns a Connection object. I don't have an init method for it as I only make instances of it when I need to use a method from it. I call it with it's only constructor which contains no arguments.
Where I'm confused is in the fact that I'm not sure if I should define an init() method for this class, or if I should make a second constuctor that I pass the Config argument to it. Basically, all I want to do is be able to obtain access to the Context so I can read the init-parameter from my web.xml file.
I mentioned this to a friend today and he suggested I approach this from a different angle and use something called the
JDBC realm in the server.xml file so I can define my connection to the database.
My only goal is to set the connection string somewhere permanently so I can read it out from my DatabaseUtils class, and not have to change it when I move between servers. Right now, I have the string hardcoded into the makeDatabaseConnection() method so when I make changes to this class on my own machine and then upload it to the live server I have to change the connection string.
I'm open to suggestions on this and appreciate the help :-)
Thanks,
-Pat