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

前端 未结 8 1849
暖寄归人
暖寄归人 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:28

    For me, it worked once I changed

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

    to:

    in POM

    
        com.microsoft.sqlserver
        mssql-jdbc
        6.1.0.jre8
    
    

    and then:

    import com.microsoft.sqlserver.jdbc.SQLServerDriver;
    

    ...

    DriverManager.registerDriver(SQLServerDriver());    
    Connection connection = DriverManager.getConnection(connectionUrl); 
    

提交回复
热议问题