protected String dbName="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test";
 protected String userId="sa";
 protected String userPassword="";
 protected String driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver";
Class.forName(driverName);
conn=DriverManager.getConnection(dbName,userId,userPassword);
上面代码调试的时候老提示 no suitable driver 错误,应该怎么解决啊?
我测试了.Class.forName(driverName);驱动程序加载没问题
conn=DriverManager.getConnection(dbName,userId,userPassword);这句数据库连接
老提示no suitable driver 错误

解决方案 »

  1.   

    jdbc:microsoft:sqlserver没有用过,
    oracle出过这种错误,是数据库驱动不对,重新放了class12.zip或jdbc就好了!你可以自己查!
      

  2.   

    有完整的代码吗?
    如果光你上面的代码的话 是你con对象没有创建吧!
      

  3.   

    那多人在用这种方式.进行数据库连接.
    都出现了类似的问题(当然包括我自己)
    ..
    你需要.在你的mssql安装一下补丁.
    (找这个:SQL2000-KB884525-SP4-x86-CHS.EXE)
    .装了它之后.
    你再运行这个程序.
    我就是这样解决.