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

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

    here is your answer

    String userName = "xxxx";
        String password = "xxxx";
        String url = "jdbc:sqlserver:xxx.xxx.xxx.xxx;databaseName=asdfzxcvqwer;integratedSecurity=true";
    
        try {
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                connection = DriverManager.getConnection(url, userName, password); 
    
      } catch (Exception e)
      {
         e.printStackTrace();
      }
    

提交回复
热议问题