JdbcodbcDriver
----^  这个o要大写
大小写问题
sun.jdbc.odbc.JdbcOdbcDriver

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/2424/2424173.xml?temp=.8593103
      

  2.   

    要把你的javabean 放在resin-dir\doc\WEB-INF\classes下
      

  3.   

    一)各种数据库jdbc驱动程序
    oracle驱动程序:http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html或者C:\oracle\ora81\jdbc\lib\classes12.zip(注意版本) 
    mysql驱动程序:http://www.mysql.com  
    sqlserver驱动程序:http://www.microsoft.com/china/sql/default.asp  下载setup.exe文件,再安装
    二)驱动的安装
    1)环境:WIN2K+j2sdk-1_4_1+tomcat连oracle817 将class12.zip文件改名为class12.jar,然后放到你的jsp目录的WEB-INF/lib下就可
      连接程序代码如下:
      <%@page contentType="text/html;charset=gb2312"%>
      <%@page import="java.sql.*"%>
      <%String sDBDrvier="oracle.jdbc.driver.OracleDriver";         
      String user="dq";
      String pwd="dqdq";
      String sConnStr="jdbc:oracle:thin:@192.168.0.49:1521:test";   //其中test是数据库的sid
      Connection conn=null;
      Statement stmt=null;
      ResultSet rs=null; 
      String sqlStr="select * from t_user";
      try{
        Class.forName(sDBDrvier);
      }
      catch(ClassNotFoundException e)
      {
        System.out.println("数据库驱动类没找到");
      }    
      try{            
         conn=DriverManager.getConnection(sConnStr,user,pwd);      
         stmt=conn.createStatement();    
         rs=stmt.executeQuery(sqlStr);  
         while(rs.next())
         {
             out.print(rs.getString("username"));
         }
         }
      catch(SQLException ex)
      {
          System.out.print(ex.getMessage());
      }
      %>
      报错原因:
      The Network Adapter could not establish the connection  这可能是oracle的服务OracleServiceXB和OracleOraHome81TNSListener没有启动
      Io 异常: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=135294976)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))  sid错误
      No suitable driver  没有安装驱动程序
       驱动程序版本不一致
    2)环境:WIN2K+j2sdk-1_4_1+tomcat连sql server2000 将msbase.jar,mssqlserver.jar,msutil.jar放到你的jsp目录的WEB-INF/lib下就可
    连接程序代码如下:
    <%@page contentType="text/html;charset=gb2312"%>
    <%@page import="java.sql.*"%>
    <%String sDBDrvier="com.microsoft.jdbc.sqlserver.SQLServerDriver";         
      String user="sa";
      String pwd="781213";
      String sConnStr="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
      Connection conn=null;
      Statement stmt=null;
      ResultSet rs=null; 
      String sqlStr="select * from t_user";
      try{
       Class.forName(sDBDrvier).newInstance(); 
      }
      catch(ClassNotFoundException e)
      {
        System.out.println("数据库驱动类没找到");
      }
      try{  
         conn=DriverManager.getConnection(sConnStr,user,pwd);
         stmt=conn.createStatement();
         rs=stmt.executeQuery(sqlStr);
         while(rs.next())
         {
             out.print(rs.getString("u_name"));
         }
         }
      catch(SQLException ex)
      {
          System.out.print(ex.getMessage());
      }
    %>
    连接access使用jdbc-odbc桥不配置odbc
    try
        {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }
        catch(ClassNotFoundException ce)
        {
          System.out.println("SQLException:"+ce.getMessage());
        }
        try
        {
          String DbUrl = "jdbc:odbc:DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};DSN='';DBQ=E:\\ms.net\\sendmessage\\vbRs232\\mobilemessage.mdb";
          String user = "";
          String password = "";
          Con=DriverManager.getConnection(DbUrl,user,password);
          stmt = Con.createStatement();
        }
        catch(SQLException e)
        {
          System.out.println("SQLException"+e.getMessage());
        }