?? dbconn.java
字號:
//******************************************************************
//(C)Copyright xxx (恒森科技)
//******************************************************************
/**
*
* DBconn 數據庫連接
*
* @author zhang-hongjing
*/
//******************************************************************
//Modification History
//
//Date Name Reason for change
//---------- ----------- -------------------------------------------
//2007/12/24 zhang-hongjing 新建
//
//
//******************************************************************
package com.common.conn;
import java.sql.*;
public class DBconn {
/* 聲明Connection對象*/
private Connection con;
/* 聲明Statement對象*/
private Statement stmt;
/* 聲明ResultSet對象*/
private ResultSet rs;
public DBconn()
{
// 使用數據源方式連接數據庫
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//數據源信息
String dbUrl="jdbc:odbc:login";
try {
con=java.sql.DriverManager.getConnection(dbUrl);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//創建Statement對象
try {
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @return con
*/
public Connection getCon() {
return con;
}
/**
* @return rs
*/
public ResultSet getRs() {
return rs;
}
/**
* @return stmt
*/
public Statement getStmt() {
return stmt;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -