database.java

来自「基于wml的手机余额查询系统」· Java 代码 · 共 107 行

JAVA
107
字号
package org.wap.jilin;

import java.sql.*;
import java.util.List;

import org.wap.util.*;

/**
 * Title:      数据访问基类
 * Description:
 * Copyright:    Copyright (c) 2003
 * Company:      万易公司
 * @author:	 李哲
 * @version 1.0
 */

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.getDBConnection();
			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 void insert() throws Exception {
		//stmt.execute(getSql());
	
	}

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

	public boolean delete() throws Exception  {
		return false;
	}
	public boolean query() throws Exception {
		return false;
	}
    
	public List queryList() throws Exception{
	   return null;
	
	}
	public void close() throws SQLException {
		if(conn !=null){
		
		if (( stmt != null ) || (prepstmt != null))
		{
			stmt.close();
			stmt = null;
		}
		conn.close();
		conn = null;
		}
	}

};



⌨️ 快捷键说明

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