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.sqlserver.jdbc.SQLServerDriver";
private static final String url = "jdbc: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();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
java入门 SSM架构,是三层结合所成的框架,分别是Spring、SpringMVC、MyBatis所组成 SpringMVC:视图层,界面层;负责接收请求,显示处理结果,管理Controller控制器对; Spring:业务层,管理service,dao,工具类对象;依赖注入来管理各层,面向切面编程管理事务,日志和权限 MyBatis:持久层;访问数据库;基于jdbc的框架,主要用来操作数据库,并且将业务实体和数据表联系起来 1、Spring (1)基本概念 Spring是一个开源开发框架,是一个轻量级控制反转(IoC)和面向切面(AOP)的容器框架。 spring主要用来开发java应用,构建J2EE平台的web应用。其核心就是提供一种新的机制管理业务对象及其依赖关系 (2)spring的优点 容器:spring是一个容器,包含并管理对象的生命周期和配置。可以配置每个bean如何被创建,基于一个可配置原型prototype,你的bean可以创建一个单独的实例或者每次需要时都生成一个新的实例。 支持AOP:spring提供对AOP的支持,它允许将一些通用任务,如安
资源推荐
资源详情
资源评论
收起资源包目录
基于java实现大学生求职就业网项目设计源码 (126个子文件)
job.bmp 2.25MB
Student.class 2KB
Conn.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
.classpath 752B
org.eclipse.wst.jsdt.ui.superType.container 49B
left.css 647B
default.css 525B
程序使用说明.doc 226KB
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
sqljdbc.jar 570KB
dx.jar 349KB
mail.jar 298KB
beandt.jar 165KB
dxejb.jar 61KB
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
Student.jbx 647B
sjob.jbx 476B
Cjob.jbx 476B
sjob.jbx 476B
Cjob.jbx 476B
Company.jbx 473B
Company.jbx 473B
jsp.jbx 91B
jsp.jbx 91B
Student.jbx~ 655B
Student.jbx~ 655B
Company.jbx~ 473B
Company.jbx~ 473B
bg.jpg 2KB
tdbg.jpg 380B
default.js 678B
.jsdtscope 500B
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 1021B
ajobinfo.jsp 907B
login.jsp 821B
login.jsp 821B
login.jsp 809B
mflink.jsp 771B
djobinfo.jsp 738B
djobinfo.jsp 737B
admin.jsp 673B
dcompany.jsp 451B
dstudent.jsp 451B
共 126 条
- 1
- 2
资源评论
大雄是个程序员
- 粉丝: 2788
- 资源: 571
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功