package wsxk;
import java.sql.*;
public class ConDB{
public static Connection init(){
Connection conn = null;
String url = "jdbc:odbc:xuanke";
//String driverName = "com.mysql.jdbc.Drive";
//String url = "jdbc:mysql://localhost:3307/xuanke";
//String user = "root";
//String password = "root";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
try {
//conn= DriverManager.getConnection(url,user,password);
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;
Connection conn= this.init();
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();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JAVA WEB 选课系统源代码 (106个子文件)
ConDB.class 3KB
Test.class 2KB
.classpath 478B
org.eclipse.wst.jsdt.ui.superType.container 49B
Thumbs.db 67KB
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
.jsdtscope 500B
adminstudent3.jsp 11KB
admincourse.jsp 11KB
adminscore.jsp 11KB
adminstudent.jsp 11KB
admincourse3.jsp 11KB
studentwsxk.jsp 10KB
adminteacher.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
log.jsp 2KB
admincourse2.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 284KB
共 106 条
- 1
- 2
资源评论
- Susum0072016-07-24资料还可以,对于我这种刚接触的人来说还是不错的
- qq_291075932016-06-18我是个初学者也不是计算机相关的专业,是经管的。 看不懂里面的代码,只为想把老师布置的作业做的好一点,但是不知道里面带的“代码、密码”要怎么输入?还请大神指点!!本人万分感谢!!!
- qq_256917412016-05-19资源一般,不过适合初学者
- The-second2015-02-11简单适用拿来应付下
- fuwenchun2013-12-17资源一般,不过适合初学者
LarryNLPIR
- 粉丝: 2860
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功