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

📄 database.java

📁  一个用JSP写的基于了B/S的图书馆管理系统
💻 JAVA
字号:
package lms;
import java.sql.*;
import lms.*;

public class DataBase{
  protected Connection con = null;
  protected Statement stm = null;
  protected PreparedStatement prepstm = null;
  protected ResultSet rs  = null;
  protected String sqlstr ;
  private boolean isConnected = true;

  public DataBase()
  {
    try
    {
      sqlstr = "";
      //DBConnection dbcon = new DBConnection();
      DBConnect dbcon = new DBConnect();
      con = dbcon.getConnection();

      stm = con.createStatement(
          ResultSet.TYPE_SCROLL_INSENSITIVE,
          ResultSet.CONCUR_UPDATABLE);

    }
    catch(Exception ex)
    {
      System.out.println(ex);
      isConnected = false;
    }
  }

  public Statement getStatement()
  {
    return this.stm;
  }

  public Connection getConnection()
  {
    return this.con;
  }

  public PreparedStatement getPreparedStatement()
  {
    return this.prepstm;
  }

  public ResultSet getResultSet()
  {
    return this.rs;
  }

  public String getSqlstr()
  {
    return this.sqlstr;
  }

  public void close() throws SQLException
  {
    if (stm !=null){
      stm.close();
      stm = null;
    }
    con.close();
    con = null;
  }

  public static void main(String[] args)
  {
    new DataBase();
  }
}

⌨️ 快捷键说明

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