📄 conndb.java
字号:
/*
* Created on 2005-6-9
*
* TODO To change the template for this generated file go to Window -
* Preferences - Java - Code Style - Code Templates
*/
package JavaPhoneTeam10;
import java.sql.*;
public class ConnDB {
public String Sqlstring;
public Connection db_conn;
public Statement db_stmt;
public ResultSet db_rset;
public ConnDB() {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
db_conn = DriverManager.getConnection(
"jdbc:oracle:thin:@192.168.9.6:1521:ibmserv", "team08",
"pass08");
db_stmt = db_conn.createStatement();
} catch (Exception e) {
e.printStackTrace();
}
}
public ResultSet executeQuery(String s) throws SQLException {
db_rset = db_stmt.executeQuery(s);
return db_rset;
}
public void executeUpdate(String s) throws SQLException {
db_stmt.executeUpdate(s);
}
public void close() throws SQLException {
if (db_conn != null)
db_conn.close();
if (db_stmt != null)
db_stmt.close();
if (db_rset != null)
db_rset.close();
}
public Connection getConnection() {
return db_conn;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -