package com.bwm.db;
import java.sql.*;
/**
*class explain:Database connection
*set up name: crazyadept
*set up time: 11/22/2004
*/
public class Conn {
private static Connection con;
private Statement stmt;
private ResultSet rs;
private static final String drivername =
"com.microsoft.jdbc.sqlserver.SQLServerDriver";
private static final String url = "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=db_Job;user=sa;password=;";
/**
*method explain: Get Connection DataBase
*modify time: 12/20/2004
*/
public static synchronized Connection getCon() throws Exception {
try {
Class.forName(drivername);
con = DriverManager.getConnection(url);
return con;
} catch (SQLException e) {
System.err.println(e.getMessage());
throw e;
}
}
/**
*output parameter: in order select in SQL
*modify time: 12/20/2004
*/
public Statement getStmtread() {
try {
con = getCon();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
return stmt;
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
return null;
}
/**
*output parameter: Data
*input parameter: SQL select sentence
*modify time: 11/29/2004
*/
public ResultSet getRs(String sql) {
try {
stmt = getStmtread();
rs = stmt.executeQuery(sql);
return rs;
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
return null;
}
/**
*output parameter: not in order select in str SQL
*modify time: 11/29/2004
*/
public Statement getStmt() {
try {
con = getCon();
stmt = con.createStatement();
return stmt;
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
return null;
}
/**
*method explain: Close DataBase Connection
*modify time: 11/29/2004
*/
public synchronized void close() {
try {
if (rs != null) {
rs.close();
rs = null;
}
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
try {
if (stmt != null) {
stmt.close();
stmt = null;
}
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
try {
if (con != null) {
con.close();
con = null;
}
} catch (Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
大学生就业信息网源代码包含数据库 (108个子文件)
job.bmp 1.24MB
Conn.class 2KB
Student.class 2KB
Data.class 2KB
Cjob.class 2KB
Sjob.class 2KB
Company.class 2KB
Time.class 2KB
Show.class 2KB
Str.class 1KB
Count.class 983B
Time.class 832B
Show.class 689B
left.css 647B
default.css 525B
0099CC.gif 30KB
top.gif 3KB
gbnavl.gif 580B
gbnavr.gif 578B
gbnavm.gif 309B
index.htm 3KB
index.htm 2KB
ajobinfo.htm 2KB
ajobinfo.htm 2KB
left.htm 2KB
left.htm 2KB
index.htm 1KB
top.htm 1KB
top.htm 721B
top.htm 721B
login.htm 617B
login.htm 561B
login.htm 549B
index.htm 382B
dx.jar 349KB
mail.jar 298KB
msbase.jar 278KB
beandt.jar 165KB
mssqlserver.jar 63KB
dxejb.jar 61KB
msutil.jar 58KB
activation.jar 53KB
Conn.java 3KB
Data.java 3KB
Student.java 2KB
Sjob.java 2KB
Company.java 2KB
Show.java 1KB
Cjob.java 1KB
Str.java 1KB
Time.java 774B
Student.jbx 647B
sjob.jbx 476B
Cjob.jbx 476B
Company.jbx 473B
jsp.jbx 91B
Student.jbx~ 655B
Company.jbx~ 473B
bg.jpg 2KB
tdbg.jpg 380B
default.js 678B
index.jsp 5KB
view.jsp 5KB
reginfo.jsp 4KB
send.jsp 4KB
reginfo.jsp 3KB
index.jsp 3KB
reg.jsp 2KB
reg.jsp 2KB
flink.jsp 2KB
student.jsp 2KB
cjob.jsp 2KB
aflink.jsp 2KB
mreginfo.jsp 2KB
company.jsp 2KB
sjob.jsp 2KB
mreginfo.jsp 2KB
login.jsp 1KB
vjobinfo.jsp 1KB
vjobinfo.jsp 1KB
ajobinfo.jsp 1019B
ajobinfo.jsp 907B
login.jsp 820B
login.jsp 820B
login.jsp 809B
mflink.jsp 771B
djobinfo.jsp 737B
djobinfo.jsp 737B
admin.jsp 673B
dcompany.jsp 451B
dstudent.jsp 451B
dcjob.jsp 448B
dsjob.jsp 448B
dflink.jsp 443B
include.jsp 162B
Data.java.LCK 10B
Show.java.LCK 10B
Conn.java.LCK 10B
Str.java.LCK 10B
Sql.java.LCK 10B
共 108 条
- 1
- 2
资源评论
二狗子溜溜溜
- 粉丝: 4
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功