你没有加载驱动程序。加载方式可如下所示:
加载jdbc-odbc桥;
Class.forName("jdbc.odbc.driver.JdbcOdbcDriver");
或者加载jdbc驱动
Class.forName("com.microft.driver.SqlServerDriver");
该class具体的我忘了,你查一下。

解决方案 »

  1.   

    jdk中只有jdbc-odbc桥,其余的jdbc都要自己安装。
      

  2.   

    可是加了这句:Class.forName("jdbc.odbc.driver.JdbcOdbcDriver");
    出现了ClassNotFoundException
      

  3.   

    package jp.co.nec.JTC;import java.sql.*;
    import java.util.*;
    import java.io.*;
    public class JTCDBConnectionF implements Serializable{
    protected Connection con = null;
    public JTCDBConnectionF() { }
    public void dbOpen() throws java.lang.Exception{
    if (con == null || con.isClosed()) {
    String url = "jdbc:oracle:oci8:@apsv";
    String user = "scott";
    String pass = "tiger";

    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

    con = DriverManager.getConnection(url,user,pass);

    con.setTransactionIsolation( con.TRANSACTION_READ_COMMITTED );
    con.setAutoCommit(false); System.out.println("DB OPEN");
    } else {
    System.out.println("OPENED DB");
    }
    }
    public JTCerrorF dbClose() {
    try {
    if (con != null && !con.isClosed()) {

    con.rollback();
    con.close();
    System.out.println("DB CLOSE");
    } else {
    System.out.println("CLOSED DB");
    }
    }
    catch (SQLException se) {
    // return new JTCerrorF(se.getErrorCode(),se);
    return new JTCerrorF("PD05",se);        //DB CLOSE
    }
    finally {
    con = null;
    }
    return (JTCerrorF)null;
    }
    }
      

  4.   

    Class.forName("jdbc.odbc.driver.JdbcOdbcDriver");
    是根据后面的字符串返回这个类的对象,你没有装这个驱动当然出现
    ClassNotFoundException
      

  5.   

    你没有把jdbcodbcdriver库放在你的工程中呀!
      

  6.   

    当然,也许是你没有设置好classpath,你自己检查一下。
      

  7.   

    1 .当然,也许是你没有设置好classpath,你自己检查一下。
    2. 你没有把jdbcodbcdriver库放在你的工程中呀!
    3. Class.forName("jdbc.odbc.driver.JdbcOdbcDriver");
    是根据后面的字符串返回这个类的对象,你没有装这个驱动当然出现
    ClassNotFoundException
    4.你是否有msbase.jar 
    mssqlserver.jar 
    msutil.jar这几个文件,如果没有,说明没有安装jdbc驱动,
    5.还可能语法错误,一个一个字符的查找