• 大小: 2.79MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-30
  • 语言: Java
  • 标签: JSP、MYSQL  

资源简介

JSP与数据库的增删改查,特别是适合新手、 JSP、MYSQL、servlet-api

资源截图

代码片段和文件信息

package dao;  
  
import java.sql.Connection;  
import java.sql.DriverManager;  
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;  
  
public class baseDao {  
    public static Connection getConnection()throws Exception{  
//        Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver“);  
//        String url=“jdbc:sqlserver://127.0.0.1:1433;database=mydb“;  
//        return DriverManager.getConnection(url “sa“ “sa“); 
     String driver = “com.mysql.jdbc.Driver“;
        String url = “jdbc:mysql://127.0.0.1:3306/test“;
        String username = “root“;
        String password = “root“;
        Connection conn = null;
        try {
            Class.forName(driver); //classLoader加载对应驱动
            conn = (Connection) DriverManager.getConnection(url username password);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }  
      
    public static void close(ResultSet rsStatement staConnection con)throws Exception{  
        if(rs!=null){  
                 //关闭结果集  
                rs.close();  
        }  
        if(sta!=null){  
                 //关闭操作句柄  
                 sta.close();  
        }  
        if(con!=null){  
                //关闭链接  
                con.close();  
        }  
    }  
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1236  2018-04-09 13:31  Project\.classpath

     文件        907  2018-04-09 10:26  Project\.project

     文件        567  2018-04-09 10:26  Project\.settings\.jsdtscope

     文件        364  2018-04-09 10:26  Project\.settings\org.eclipse.jdt.core.prefs

     文件        473  2018-04-09 10:26  Project\.settings\org.eclipse.wst.common.component

     文件        345  2018-04-09 10:26  Project\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2018-04-09 10:26  Project\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2018-04-09 10:26  Project\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       1491  2018-04-09 13:31  Project\src\dao\baseDao.java

     文件       5986  2018-04-11 13:44  Project\src\dao\UserInfoDao.java

     文件       1416  2018-04-09 10:34  Project\src\entity\UserInfo.java

     文件       6193  2018-04-09 13:38  Project\WebContent\add.jsp

     文件       2599  2018-04-09 10:51  Project\WebContent\doadd.jsp

     文件       2637  2018-04-09 10:52  Project\WebContent\doRemove.jsp

     文件       1547  2018-04-09 10:53  Project\WebContent\doUpdate.jsp

     文件       2290  2018-04-09 13:46  Project\WebContent\index.jsp

     文件         39  2018-04-09 10:26  Project\WebContent\meta-INF\MANIFEST.MF

     文件       5354  2018-04-09 10:52  Project\WebContent\update.jsp

     文件       1558  2018-04-09 13:32  Project\WebContent\WEB-INF\classes\dao\baseDao.class

     文件       4356  2018-04-11 13:44  Project\WebContent\WEB-INF\classes\dao\UserInfoDao.class

     文件       1691  2018-04-09 13:32  Project\WebContent\WEB-INF\classes\entity\UserInfo.class

     文件     124727  2016-02-08 22:28  Project\WebContent\WEB-INF\lib\jasper-el.jar

     文件     601593  2016-02-08 22:28  Project\WebContent\WEB-INF\lib\jasper.jar

     文件      87805  2016-02-08 22:28  Project\WebContent\WEB-INF\lib\jsp-api.jar

     文件    1004840  2018-04-09 10:32  Project\WebContent\WEB-INF\lib\mysql-connector-java-5.1.46-bin.jar

     文件    1004838  2018-04-09 10:32  Project\WebContent\WEB-INF\lib\mysql-connector-java-5.1.46.jar

     文件     198017  2016-02-08 22:28  Project\WebContent\WEB-INF\lib\servlet-api.jar

     文件        650  2018-04-09 10:26  Project\WebContent\WEB-INF\web.xml

     目录          0  2018-04-09 13:32  Project\WebContent\WEB-INF\classes\dao

     目录          0  2018-04-09 13:32  Project\WebContent\WEB-INF\classes\entity

............此处省略17个文件信息

评论

共有 条评论