?? database.java
字號:
package com.database;
import java.sql.*;
/**
*這里將訪問數據庫的各種操作封裝成一個類
*/
public class DataBase {
protected Connection conn=null; //Connection接口
protected Statement stmt=null; //Statement接口
protected ResultSet rs=null; //記錄結果集
protected PreparedStatement prepstmt =null;//PreparedStatement接口
protected String sql; //sql語句
protected boolean Connect=true;//與數據庫連接標識
public DataBase(){
try{
sql="";
DBConnection db=new DBConnection();
conn=db.getConnection();
stmt=conn.createStatement();
}catch(Exception e){
System.out.print(e);
Connect=false;
}
}
public Connection getConn() {
return conn;
}
public boolean isConnect() {
return Connect;
}
public PreparedStatement getPrepstmt() {
return prepstmt;
}
public ResultSet getRs() {
return rs;
}
public String getSql() {
return sql;
}
public Statement getStmt() {
return stmt;
}
public boolean excute() 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;
}
conn.close();
conn=null;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -