📄 dbconnect.java
字号:
}
public boolean first() throws DBConnException, SQLException {
boolean b = false;
try {
b = rs.first();
} catch (Exception exception) {
// exception;
close();
System.err.println("first error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Query Failed! Are you sure you have done executeQuery?\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
return (b);
}
public boolean absolute(int row) throws DBConnException, SQLException {
boolean b = false;
try {
b = rs.absolute(row);
} catch (Exception exception) {
close();
System.err.println("last error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Query Failed! Are you sure you have done executeQuery?\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
return (b);
}
public boolean last() throws DBConnException, SQLException {
boolean b = false;
try {
b = rs.last();
} catch (Exception exception) {
// exception;
close();
System.err.println("last error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Query Failed! Are you sure you have done executeQuery?\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
return (b);
}
public boolean isFirst() throws DBConnException, SQLException {
boolean b = false;
try {
b = rs.isFirst();
} catch (Exception exception) {
// exception;
close();
System.err.println("isFirst error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Query Failed! Are you sure you have done executeQuery?\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
return (b);
}
public boolean isLast() throws DBConnException, SQLException {
boolean b = false;
try {
b = rs.isLast();
} catch (Exception exception) {
// exception;
close();
System.err.println("isLast error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Query Failed! Are you sure you have done executeQuery?\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
return (b);
}
public boolean isBeforeFirst() throws DBConnException, SQLException {
boolean b = false;
try {
b = rs.isBeforeFirst();
} catch (Exception exception) {
// exception;
close();
System.err
.println("isBeforeFirst error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Query Failed! Are you sure you have done executeQuery?\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
return (b);
}
public boolean isAfterLast() throws DBConnException, SQLException {
boolean b = false;
try {
b = rs.isAfterLast();
} catch (Exception exception) {
// exception;
close();
System.err.println("isAfterLast error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Query Failed! Are you sure you have done executeQuery?\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
return (b);
}
public boolean getDefaultCommit() {
boolean b = false;
try {
b = conn.getAutoCommit();
} catch (SQLException sqlexception) {
// sqlexception;
System.err.println("getDefaultCommit error: "
+ sqlexception.getMessage());
}
return (b);
}
public void setAutoCommit(boolean flag) throws DBConnException {
try {
conn.setAutoCommit(flag);
} catch (Exception exception) {
close();
System.err
.println("setAutoCommit error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Connection autoCommit reset Failed!\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
}
public void submitCommit() throws DBConnException {
try {
conn.commit();
} catch (Exception exception) {
close();
System.err.println("submitCommit error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Connection commit Failed!\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
}
public void rollBack() throws DBConnException {
try {
conn.rollback();
} catch (Exception exception) {
close();
System.err.println("rollBack error: " + exception.getMessage());
throw new DBConnException(
"<h5>\u3010Database Connection rollback Failed!\u3011</h5>ErrorInfo\uFF1A"
+ exception);
}
}
public boolean getBoolean(int i) throws DBConnException, SQLException {
return rs.getBoolean(i);
}
public boolean getBoolean(String s) throws DBConnException, SQLException {
return rs.getBoolean(s);
}
public byte getByte(int i) throws DBConnException, SQLException {
return rs.getByte(i);
}
public byte getByte(String s) throws DBConnException, SQLException {
return rs.getByte(s);
}
public byte[] getBytes(int i) throws DBConnException, SQLException {
return rs.getBytes(i);
}
public byte[] getBytes(String s) throws DBConnException, SQLException {
return rs.getBytes(s);
}
public Date getDate(int i) throws DBConnException, SQLException {
return rs.getDate(i);
}
public Date getDate(String s) throws DBConnException, SQLException {
return rs.getDate(s);
}
public Timestamp getTimestamp(int i) throws DBConnException, SQLException {
return rs.getTimestamp(i);
}
public Timestamp getTimestamp(String s) throws DBConnException,
SQLException {
return rs.getTimestamp(s);
}
public Timestamp getTimpstamp(int i, Calendar cal) throws DBConnException,
SQLException {
return rs.getTimestamp(i, cal);
}
public Timestamp getTimestamp(String s, Calendar cal)
throws DBConnException, SQLException {
return rs.getTimestamp(s, cal);
}
public Time getTime(int i) throws DBConnException, SQLException {
return rs.getTime(i);
}
public Time getTime(String s) throws DBConnException, SQLException {
return rs.getTime(s);
}
public double getDouble(int i) throws DBConnException, SQLException {
return rs.getDouble(i);
}
public double getDouble(String s) throws DBConnException, SQLException {
return rs.getDouble(s);
}
public float getFloat(int i) throws DBConnException, SQLException {
return rs.getFloat(i);
}
public float getFloat(String s) throws DBConnException, SQLException {
return rs.getFloat(s);
}
public int getInt(int i) throws DBConnException, SQLException {
return rs.getInt(i);
}
public int getInt(String s) throws DBConnException, SQLException {
return rs.getInt(s);
}
public long getLong(int i) throws DBConnException, SQLException {
return rs.getLong(i);
}
public long getLong(String s) throws DBConnException, SQLException {
return rs.getLong(s);
}
public short getShort(int i) throws DBConnException, SQLException {
return rs.getShort(i);
}
public short getShort(String s) throws DBConnException, SQLException {
return rs.getShort(s);
}
public String getString(int i) throws DBConnException, SQLException,
UnsupportedEncodingException {
return rs.getString(i);
}
public String getString(String s) throws DBConnException, SQLException,
UnsupportedEncodingException {
return rs.getString(s);
}
public Clob getClob(int i) throws DBConnException, SQLException,
UnsupportedEncodingException {
return rs.getClob(i);
}
public Clob getClob(String s) throws DBConnException, SQLException,
UnsupportedEncodingException {
return rs.getClob(s);
}
public void setBoolean(int i, boolean flag) throws DBConnException,
SQLException {
preStmt.setBoolean(i, flag);
}
public void setByte(int i, byte byte0) throws DBConnException, SQLException {
preStmt.setByte(i, byte0);
}
public void setBytes(int i, byte abyte0[]) throws DBConnException,
SQLException {
preStmt.setBytes(i, abyte0);
}
public void setDate(int i, Date date) throws DBConnException, SQLException {
preStmt.setDate(i, date);
}
public void setTime(int i, Time time) throws DBConnException, SQLException {
preStmt.setTime(i, time);
}
public void setShort(int i, short word0) throws DBConnException,
SQLException {
preStmt.setShort(i, word0);
}
public void setInt(int i, int j) throws DBConnException, SQLException {
preStmt.setInt(i, j);
}
public void setLong(int i, long l) throws DBConnException, SQLException {
preStmt.setLong(i, l);
}
public void setFloat(int i, float f) throws DBConnException, SQLException {
preStmt.setFloat(i, f);
}
public void setDouble(int i, double d) throws DBConnException, SQLException {
preStmt.setDouble(i, d);
}
public void setString(int i, String s) throws DBConnException,
SQLException, UnsupportedEncodingException {
preStmt.setString(i, s);
}
public void clearParameters() throws DBConnException {
try {
if (preStmt != null)
preStmt.clearParameters();
} catch (SQLException sqlexception) {
throw new DBConnException(sqlexception.getMessage());
}
}
public void closePreStmt() throws DBConnException {
try {
if (preStmt != null) {
preStmt.clearParameters();
preStmt.close();
preStmt = null;
}
} catch (SQLException sqlexception) {
System.err
.println("\u5173\u95EDPrepareStatement\u9519\u8BEF\u3002ErrorInfo: "
+ sqlexception.toString());
preStmt = null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -