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