u should set ur classpath,before u run this command,or get the classpath parameter to the java command.

解决方案 »

  1.   

    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); 
    变为:
    Class.forName("com.jnetdirect.jsql.JSQLDriver");
      

  2.   

    不能直接从jsp中copy到java中,因为你的很多异常都没有捕获,例如 Class.forName有的SQLException,ClassNotFoundException
      

  3.   

    一样的。
    这种错误是你没有配置你的参数。在JBuild中你将驱动三个文件加进来。tools---enterprice setup
      

  4.   

    java中要求所有异常必须处理,每个类对应的异常可以到sdk手册中找到
      

  5.   

    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");  你在odbc 中要配置的
      

  6.   

    public static void main(String args[]) throws SQLException
    改main函数声明
      

  7.   

    http://www.chinabs.net/java/default.asp?infoid=151
    是一个jdbc连接MsSQL Server2000的例子
      

  8.   

    没有抛异常
    String    drv = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
       String    url = "jdbc:microsoft:sqlserver://127.0.0.1:1433";
       String    uid = "sa";
       String    pwd = "123456";   Connection cn=null;
       try
       {
         Class.forName(drv).newInstance();
         cn=DriverManager.getConnection(url,uid,pwd);
       }
       catch (Exception e)
       {
       e.printStackTrace();
       }http://www.chinajavaworld.net/forum/view.cgi?forum=44&topic=346