使用jdbc的SQL Server连接错误

时间:2015-11-18 09:17:11

标签: java sql-server jdbc

我尝试了下面的代码,我收到了这个错误:

java.sql.SQLException: No suitable driver found for jdbc:sqlserver://Usatlbyq.na.ko.com:1433;integratedSecurity=true;
    at java.sql.DriverManager.getConnection(DriverManager.java:689)
    at java.sql.DriverManager.getConnection(DriverManager.java:270)
    at testing.testingsql.main(testingsql.java:19)

我正在使用以下代码:

package testing;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class testingsql {
    public static Connection conn = null;
    //private String dbName = null;


  public static void main(String[] args) throws IOException {

        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            conn = DriverManager.getConnection("jdbc:sqlserver://Usatlbyq.na.ko.com:1433;integratedSecurity=true;");//here put the new simple url.
            System.out.println("succesful connection");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    public ResultSet runSql(String sql) throws SQLException {
        Statement sta = conn.createStatement();
        return sta.executeQuery(sql);
    }

}

1 个答案:

答案 0 :(得分:1)

您的网址应为 * * * * * php /var/www/html/archive/artisan schedule:run >> /dev/null 2>&1