| 123456789101112131415161718192021222324252627282930313233 |
- <%--
- Created by IntelliJ IDEA.
- User: LENOVO
- Date: 2022/4/13
- Time: 11:53
- To change this template use File | Settings | File Templates.
- --%>
- <%@ page contentType="text/html;charset=UTF-8" language="java" %>
- <%@ page language="java" pageEncoding="GB2312" %>
- <%@ page import="java.sql.*,javax.sql.*,javax.naming.*" %>
- <html>
- <head>
- <title>配置数据源</title>
- </head>
- <body>
- <%
- Connection conn=null;
- //String url="jdbc:mysql://localhost:3306/edu";
- //String user="root";
- //String password="123456";
- try{
- InitialContext ctx = new InitialContext();
- DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/edu");
- conn = ds.getConnection();
- if(conn != null){
- out.println("数据源 jdbc/edu 配置正确!");
- }
- }catch(Exception ex){
- out.println("数据库驱动加载出现错误!"+ex);
- }
- %>
- </body>
- </html>
|