package wsxk;
import java.sql.*;
public class ConDB{
public static Connection init(){
Connection conn = null;
String url = "jdbc:odbc:xuanke";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
try {
conn= DriverManager.getConnection(url);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return conn;
}
public ResultSet executeQuery(String sql)
{
ResultSet rs = null;
try {
rs = null;
//System.out.println(url);
Connection conn= this.init();
//System.out.println(url);
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery(sql);
}
catch (SQLException ex) {
System.out.println("执行错误");
ex.printStackTrace();}
return rs;
}
public void executeUpdate(String strSQL)
{
try
{
Connection conn= this.init();
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
stmt.executeQuery(strSQL);
}
catch(SQLException ex)
{
System.err.println("连接数据库失败了,异常为:" +ex.getMessage());
}
}
public String ex_chinese(String str)
{
if(str==null)
{
str ="" ;
}
else
{
try
{
str = new String(str.getBytes("iso-8859-1"),"gb2312") ;
}
catch (Exception ex)
{
System.err.println("异常为:" +ex.getMessage());
}
}
return str ;
}
public String gettime()
{
String datestr = "" ;
try
{
java.text.DateFormat df = new java.text.SimpleDateFormat("yyyy年MM月dd日 HH点ss分") ;
java.util.Date date = new java.util.Date() ;
datestr = df.format(new java.util.Date()) ;
}
catch (Exception ex)
{
System.err.println("异常为:" +ex.getMessage());
}
return datestr ;
}
public static void main(String args[]){
ConDB c = new ConDB();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
jsp+servlet+javabean在线选课系统 (102个子文件)
ConDB.class 3KB
Test.class 2KB
.classpath 340B
bianpeng.gif 17KB
403.gif 13KB
404.gif 11KB
bian.gif 11KB
lyb.gif 8KB
blank_banner.gif 2KB
green.gif 728B
red.gif 717B
yellow.gif 715B
bg.gif 391B
snap.gif 232B
spacer.gif 43B
index1.htm 4KB
adminteacherdelerr.htm 724B
adminstudentdelerr.htm 720B
admincoursedelerr.htm 719B
studentcjcxerr.htm 683B
studentcjcxerr2.htm 681B
err.htm 676B
adminstudenterr.htm 654B
adminteachererr.htm 648B
admincourseerr.htm 647B
adminscoreerr.htm 646B
ConDB.java 3KB
Test.java 1KB
qa.jpg 20KB
13adobe19.jpg 18KB
13adobe11.jpg 17KB
err.jpg 17KB
index_globe.jpg 17KB
tx.jpg 16KB
bg_middle.jpg 14KB
pic_04.jpg 13KB
030306xbutton07.jpg 12KB
index2.jpg 11KB
030123crystal0104.jpg 10KB
bg.jpg 9KB
left_top.jpg 8KB
left_bottom.jpg 7KB
pic_01.jpg 5KB
pic_03.jpg 5KB
pic_02.jpg 5KB
main_bg.jpg 4KB
temp_10.jpg 2KB
temp_02.jpg 1KB
temp_03.jpg 1KB
temp_01.jpg 1KB
temp_07.jpg 1KB
temp_09.jpg 987B
bg_01.jpg 534B
bg_nav.jpg 367B
bg_bottom.jpg 356B
temp_05.jpg 348B
bg_nav_02.jpg 334B
adminstudent3.jsp 11KB
admincourse.jsp 11KB
adminscore.jsp 11KB
adminstudent.jsp 11KB
admincourse3.jsp 11KB
adminteacher.jsp 10KB
studentwsxk.jsp 10KB
studentqbkb.jsp 10KB
studentcjcx3.jsp 10KB
studentcjcx2.jsp 10KB
admintc.jsp 9KB
teacherqbkb.jsp 9KB
admintc3.jsp 9KB
adminteacher3.jsp 9KB
studentxkd.jsp 8KB
adminlyb.jsp 8KB
studentcjcx.jsp 7KB
teacherkccx.jsp 7KB
index3.jsp 6KB
index2.jsp 5KB
index1.jsp 5KB
lyb.jsp 5KB
adminscore2.jsp 3KB
admintc2.jsp 3KB
adminstudent4.jsp 2KB
adminteacher4.jsp 2KB
admincourse4.jsp 2KB
lyb2.jsp 2KB
adminstudent2.jsp 2KB
admincourse2.jsp 2KB
log.jsp 2KB
adminteacher2.jsp 2KB
studentwsxk2.jsp 2KB
adminteacher5.jsp 1KB
adminstudent5.jsp 1KB
admincourse5.jsp 1KB
studentxkd2.jsp 1KB
adminlyb2.jsp 1KB
index.jsp 626B
xuanke.mdb 276KB
MANIFEST.MF 39B
.mymetadata 318B
.project 1KB
共 102 条
- 1
- 2
资源评论
- cy13790402052015-04-14还是不错的。写的很详细
- dddsssjjjwet2012-06-15很不错,还带着数据库
moon&sean
- 粉丝: 49
- 资源: 51
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 上市公司-人工智能的采纳程度面板数据(2003-2021年).xlsx
- 第5章spring-mvc请求映射处理
- 2023-04-06-项目笔记 - 第一百十六阶段 - 4.4.2.114全局变量的作用域-114 -2024.04.27
- app-release.apk.1
- soap json 等系列化方式
- c++的五子棋代码,在vs6.0上完美运行
- 基于Javaee的影视创作论坛的设计与实现.rar
- Python导出Mysql数据字典(部分表或全表)
- Java工具类实现输入一个路径,强创建路径、并且鉴权目标路径是否具备修改权限,用于增强程序的健壮性与稳定性,快速开发!
- 资源【STM32+HAL】三轴按键PS2摇杆
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功