com.microsoft.sqlserver.jdbc.SQLServerDriver not found error

前端 未结 8 1858
暖寄归人
暖寄归人 2021-02-13 14:56

I am trying to connect to my SQL Server 2008 database from Java and I\'m having the same problem from this thread.

String userName = \"xxxx\";
String password =          


        
8条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-13 15:15

    You are looking at sqljdbc4.2 version like :

    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    

    but, for sqljdbc4 version statement should be:

    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    

    I think if you change your first version to write the correct Class.forName , your application will run.

提交回复
热议问题