⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 database.java

📁 jsp开发常用信息管理系统适合初学者学习 网上购物
💻 JAVA
字号:
package ch09.web;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import ch09.util.DBConnectionManager;

/**
 * @author <a href='chengweits@hotmail.com'>chengwei</a>
 * 用户登录信息检查
 */

public class DataBase {
	protected Connection conn = null;		//Connection接口
	protected Statement stmt = null;		//Statement接口
	protected ResultSet rs = null;		//记录结果集
	protected PreparedStatement prepstmt = null;	//PreparedStatement接口
	protected String sqlStr;		//sql String
	protected boolean isConnect=true;	//与数据库连接标识
	
	public DataBase() {
		try
		{
			sqlStr = "";
			DBConnectionManager dcm = new DBConnectionManager();
			conn = dcm.getConnection();
			stmt = conn.createStatement();
		}
		catch (Exception e)
		{
			System.out.println(e);
			isConnect=false;
		}
		
	}

	public Statement getStatement() {
		return stmt;
	}

	public Connection getConnection() {
		return conn;
	}

	public PreparedStatement getPreparedStatement() {
		return prepstmt;
	}

	public ResultSet getResultSet() {
		return rs;
	}


	public String getSql() {
		return sqlStr;
	}

	public boolean execute() throws Exception  {
		return false;
	}

	public boolean insert() throws Exception {
		return false;
	}

	public boolean update() throws Exception  {
		return false;
	}

	public boolean delete() throws Exception  {
		return false;
	}
	public boolean query() throws Exception {
		return false;
	}

	public void close() throws SQLException {
		if ( stmt != null )
		{
			stmt.close();
			stmt = null;
		}
		if ( prepstmt != null )
		{
		    prepstmt.close();
		    prepstmt = null;
		}
		if(conn != null){
		    conn.close();
		    conn = null;
		}
	}
}

⌨️ 快捷键说明

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