First I would like to thank all of you for ur patience with me... my problem is I HATE reading documentation and references. I'm a trial-and-error developer... sometimes that's good, and sometimes (like today) it is not.
I will now try to explain my problem with some code to be sure I won't get missunderstood. But before anything... I don't have ANY Servlets here... I was totally tripping... I tought a Servlet was the solution, but it is not. I only have JSPs (which I know are Servlets) and Beans. let's go: I have a webapp with lots of JSPs and classes... in my JSPs I have something like this: <%@page import="SomeBusinessObject"%> <% SomeBusinessObject sbo = new SomeBusinessObject(); sbo.setParameters( request.getParameter("id1"), request.getParameter("id2") ); sbo.getSomeAttribute(); sbo.setSomeAttribute(); sbo.update(); sbo.delete()... etc.. etc... ... lots of other code... %> this SomeBusinessObject will have a reference to a DAOSomeBusinessObject where all the queries (insert, delete, update, select) resides... and that setParameters() method is only for it to know which row of the database we're handling with, the parameters match with the table keys of course. But that is irrelevant here. I have also a class called DAO which provides all of the other DAO*s with a Connection... this is done internally within each DAO*. the method bellow is in DAO, which all the other DAO*s call to get the Connection. public static synchronized Connection getConnection(String usr, String pwd, String url, String driver) { Connection con = null; // some code here to make some checks... irrelevant.... try { Class.forName( driver ); con = DriverManager.getConnection(url, usr, pwd); } catch(ClassNotFoundException cnf) { System.out.println ("*** Erro: driver nao encontrado! "+cnf.getMessage()); } catch(SQLException sql) { String detalhes = "URL = "+url+"\nUSER = "+usr+"\nPWD = "+pwd; System.out.println("*** Erro ao obter conexão! "+sql.getMessage()+"\n"+detalhes ); } // a little bit more code.... return con; } now the problem - I'll try to be very clear (my english SUX, please be patient with me). the webapp points to a specific db URL... this URL is in the DAOMain... if I want to change the db, I'll have to change DAOMain, recompile it, and overwrite it... nothing weird so far. Right? The big thing is: this webapp gets replicated... so I copy the ENTIRE dir... classes, JSPs, jars... everything... and I know how stupid this is... and that's the problem... - in each of these webapps, the only thing that changes is the JSPs, and maybe the DB url... WHAT I WANT IS: I want to put our classes, jars and the oracle driver in the $TOMCAT_HOME\common dir, because they don't change from one webapp to another.... BUT since DAOMain holds the URL this is not possible (each webapp must have its own DAOMain)... I wanna create a CLASS that will receive a request from DAO or DAOMain (residing in \common) and provide a Connection based on the Context of the JSP that used SomeBusinessObject -> DAOSomeBusinessObject -> DAO. or maybe DAO could do that... let's say I would write some code in getConnection() to find out where (Context) it is (well... actually DAO is always in the same place.. but the JSP that uses it, and calls it, is not) to provide the right Connection... BUT without ANY change of parameters to getConnection(), since that would snowball into a mega change of method's signatures that would end in the JSPs... (I'm tired...) well... that's it... I don't think I can be clearer than that... my english stops here... :) .:| Christian J. Dechery .:| FINEP - Depto. de Sistemas .:| [EMAIL PROTECTED] .:| (21) 2555-0332