dbconnect.jsp

来自「基于servlet的图书馆管理系统,学习参考」· JSP 代码 · 共 24 行

JSP
24
字号
<%@ 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();  

%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?