0

I tried below code and I am getting this error:

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)

I am using below code:

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
  • what is your mssql version? Commented Nov 18, 2015 at 9:24

1 Answer 1

1

Your URL should be jdbc:sqlserver://server:port;DatabaseName=dbname

Sign up to request clarification or add additional context in comments.

1 Comment

The used URL: jdbc:sqlserver://Usatlbyq.na.ko.com:1433;integratedSecurity=true; looks OK to me. The DatabaseName parameter is not required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.