1st you need to configure
Tomcat 5.5 with admin console. After configuring that Create a helper class. Use JNDI to look up the connection. Create a static method to get connection(the return type for which is Connection)
I am providing you some part of the code
Whenever you want to create a connection( logical connection), just call Classname.getConnection. (in my case DbUtil.getConnection)