Hello again. Ive managed to get this working, which took a bit of time, but
im a little confused on how to do it more efficently. I currenty access my
mysql db through a servlet with the follwing code

InitialContext initCtx = new InitialContext();
                        Context envCtx = (Context) 
initCtx.lookup("java:comp/env");
                        DataSource ds = 
(DataSource)envCtx.lookup("jdbc/mainDB");
                        con = ds.getConnection();

ive seen bits of code of the web which use factorys and /or singleton
classes for this. Im sure 3 or 4 lines can be cut out of the code that
should be called everytime the servlet is called. Any advice would be
helpful!
-- 
View this message in context: 
http://www.nabble.com/Using-DBCP-DataSource-w--Tomcat-6-tp24536575p24536575.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to