I am using type 4 database driver in my jsp application. I want to make common database connection which will be used in any jsp page in my application. (ie; I do'nt want to write code for database connecion in every jsp page).
It means that you have to write a javabean that has a method to establish database connection using JDBC. The method shall return a connection object. You have to call it with <jsp:useBean> action element in those JSPs where you want DB connections. Be sure to provide a code to close the connection after use.
RAGHU<br /> <br />"When the going gets tough, the tough get going"
Bottom line...Have a class that will encapsulate all your database tasks such as connection, updates, select, etc. You will have several methods that will handle these functionality. Make the class available to your JSP, and call the methods at appropriate times from the JSP.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Please check the license aspect of that site/code. I have given the reference just as a pointer to what the Utility class should contain. In designing lingo, this class is often referred as a BaseDAO, where DAO stands for Data Access Object.
subject: How to create common database connection in a application