jdbc 只能java_为什么出现java.lang.ClassNotFoundException: sun.jdbc.odbc.jdbcOdbcDriver还可以...

为什么出现java.lang.ClassNotFoundException: sun.jdbc.odbc.jdbcOdbcDriver还可以

我的在eclips里编译,java.lang.ClassNotFoundException: sun.jdbc.odbc.jdbcOdbcDriver 这个错误,但是还是可以继续运行,也可以和数据库建立连接,而且在jsp页面中用javabean调用时,也可以连接上数据库,就是不知道为什么。

try{

try{

Class.forName("sun.jdbc.odbc.jdbcOdbcDriver");

System.out.println("driver registed");

}catch(ClassNotFoundException ex){ System.out.println(ex.toString());}

catch(Exception e){}

Connection connection=DriverManager.getConnection("jdbc:odbc:student3");//"jdbc:odbc:student3"

System.out.println("db connected");

ps3=connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

ps4=connection.prepareStatement("select 车号,车型,始发站,途经1,途经2,途经3,途经4,途经5,目的地,软席剩余座位,硬座剩余座位,站票数目,目的地类别,目的地序列号,到达南京日期,到达南京站时间,可以选择,新字段 from train where 到达南京日期=? and 到达南京站时间=?",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

ps=connection.prepareStatement("select 车号,车型,始发站,途经1,途经2,途经3,途经4,途经5,目的地,软席剩余座位,硬座剩余座位,站票数目,目的地类别,目的地序列号,到达南京日期,到达南京站时间,可以选择,新字段 from train where 到达南京日期=? and 目的地类别=? and 目的地序列号>=?",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

ps2=connection.prepareStatement("select 地点,类别,序列号,空调特快,空调普快,硬座普快 from placeinformation where 地点=?",ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

运行结果:

java.lang.ClassNotFoundException: sun.jdbc.odbc.jdbcOdbcDriver

db connected

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值