【JSP开源代码栏目提醒】:网学会员鉴于大家对JSP开源代码十分关注,论文会员在此为大家搜集整理了“dbconnect.jsp”一文,供大家参考学习
<%@ page import="sjservlets.*, java.sql.*" %>
<%
ConnectionPool connectionPool;
int vendor = DriverUtilities.MYSQL;
String driver = DriverUtilities.getDriver(vendor);
String host = "localhost";
String dbName = "jsp_library";
String url = DriverUtilities.makeURL(host, dbName, vendor);
String username = "root";
String password = "masteryoda";
try {
connectionPool =
new ConnectionPool(driver, url, username, password, 10, 50, true);
} catch(SQLException sqle) {
System.err.println("Error making pool: " + sqle);
getServletContext().log("Error making pool: " + sqle);
connectionPool = null;
}
// connectionPool.closeAllConnections();
%>