📄 database.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 + -