• 大小: 16.7MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-03
  • 语言: Java
  • 标签:

资源简介

开发JSP&Servlet&JavaBean的项目(E-家园)开发JSP&Servlet&JavaBean的项目(E-家园)开发JSP&Servlet&JavaBean的项目(E-家园)

资源截图

代码片段和文件信息

package com.ownHome.common;

import java.sql.*;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class DBConnection {
/**
 * 通过数据源获取数据库连接
 * @return 数据库连接
 */
public static Connection getConnection(){
Connection dbConnection = null;
try {
Context ic = new InitialContext();
DataSource source = (DataSource)ic.lookup(“java:comp/env/jdbc/ownHome“);
dbConnection = source.getConnection();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return dbConnection;
}

/*通过配置文件获取数据库连接
public static synchronized Connection getConnection(){
String driverClassName = ProReader.getInstance().getProperty(“driver“);
String url = ProReader.getInstance().getProperty(“url“);
String user = ProReader.getInstance().getProperty(“user“);
String password = ProReader.getInstance().getProperty(“password“);
Connection dbConnection = null;
try {
Class.forName(driverClassName);
dbConnection = DriverManager.getConnection(urluserpassword);
} catch (Exception e) {
e.printStackTrace();
}
return  dbConnection;
}
*/

/**
 * 释放资源
 * @param conn
 * @param pstmt
 * @param rs
 */
public static void closeAll(Connection connPreparedStatement pstmtResultSet rs){
try {
if(rs != null){
rs.close();
rs = null;
}
if(pstmt != null){
pstmt.close();
rs = null;
}
if(conn != null && (!conn.isClosed())){
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}

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

     文件        784  2009-07-04 01:18  ownHome\.classpath

     文件        294  2009-07-04 01:18  ownHome\.mymetadata

     文件       1225  2009-07-16 12:44  ownHome\.project

     文件        875  2009-07-16 14:45  ownHome\context.xml

     文件    3145728  2009-07-04 01:39  ownHome\Database\ownHome.mdf

     文件       3581  2008-01-03 13:53  ownHome\Database\ownHome.sql

     文件    1048576  2009-07-04 01:39  ownHome\Database\ownHome_log.ldf

     文件       1707  2009-06-24 07:53  ownHome\src\com\ownHome\common\DBConnection.java

     文件        135  2009-07-16 13:10  ownHome\src\com\ownHome\common\dbInfo.properties

     文件        711  2009-07-16 13:24  ownHome\src\com\ownHome\common\ProReader.java

     文件       1004  2009-07-16 13:02  ownHome\src\com\ownHome\entity\Article.java

     文件        851  2009-07-16 12:58  ownHome\src\com\ownHome\entity\Users.java

     文件       3618  2009-07-03 23:02  ownHome\src\com\ownHome\operation\ArticleBo.java

     文件       1515  2009-07-02 06:34  ownHome\src\com\ownHome\operation\UsersBo.java

     文件       3838  2009-07-03 23:46  ownHome\src\com\ownHome\servlet\AddBookServlet.java

     文件       2290  2009-07-01 12:26  ownHome\src\com\ownHome\servlet\DetailArticleServlet.java

     文件       2085  2009-07-02 10:52  ownHome\src\com\ownHome\servlet\InvalidateServlet.java

     文件       2474  2009-07-02 06:41  ownHome\src\com\ownHome\servlet\LoginServlet.java

     文件       2681  2009-07-03 22:20  ownHome\src\com\ownHome\servlet\RegisterServlet.java

     文件       2395  2009-07-03 23:05  ownHome\src\com\ownHome\servlet\SearchServlet.java

     文件       3052  2009-07-02 06:23  ownHome\src\com\ownHome\servlet\SelectArticleServlet.java

     文件       6098  2009-07-04 00:15  ownHome\WebRoot\addBook.jsp

     文件       1513  2007-09-25 11:55  ownHome\WebRoot\banner.jsp

     文件       2083  2004-06-28 17:14  ownHome\WebRoot\css.css

     文件       3054  2009-07-16 16:51  ownHome\WebRoot\detailArticle.jsp

     文件      30641  2004-06-28 17:17  ownHome\WebRoot\images\banner.gif

     文件      31540  2007-09-27 13:47  ownHome\WebRoot\images\banner.swf

     文件        128  2004-06-28 17:17  ownHome\WebRoot\images\bg01.gif

     文件         96  2004-06-28 17:17  ownHome\WebRoot\images\bg02.gif

     文件        275  2004-06-28 17:17  ownHome\WebRoot\images\bg03.gif

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

评论

共有 条评论

相关资源