conndb.java

来自「java编写的sip协议软电话,结构非常清晰的SIP协议栈」· Java 代码 · 共 54 行

JAVA
54
字号
/*
 * 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 + =
减小字号Ctrl + -
显示快捷键?