Hi, I am trying to get my DataSource (with Connection Pooling) to run. In the examples one always gets the DataSource from JNDI and I have the impression that everytime I want to get my connection from DataSource via a Context lookup.
Wouldn't it be better to read the data source once in a singleton class and then just get it back, i.e. private DataSource ds; ... public static void getDataSource() { // if data source unknown read it from context if (ds == null) { try { Context ctx = new InitialContext(); ds = (DataSource) ctx.lookup("java:comp/env/jdbc/myDataSource"); } catch (..) {..} } return ds; } This should be faster than accessing the context every time you need a datasource or a connection. Could this lead into problems? Any suggestions? Cheers, Holger ----------------------------------------------------- Holger Maier Tel.: (06831) 47-3497 ITS-AKIS eMail: [EMAIL PROTECTED] AG der Dillinger Hüttenwerke Postfach 1580 66748 Dillingen -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>