No suitable driver found for jbdc: sqlserver

0

I have followed all the steps I find, I have tried several versions of the driver but still it does not let me connect and says that the driver version is not compatible This is the code I use to try to connect

package dbtienda;
import java.sql.SQLException;
import java.sql.DriverManager;
import java.sql.*;


public class DBtienda {

/**
 * @param args the command line arguments
 */

public static Connection getConnection() {
    Connection connection = null;
    String dbName = "tienda";
    String user = "conexion";
    String pass = "3312";
    try {
        //Class.forName("com.microsoft.sqlserver.jbdc.SQLServerDriver");
        //String connectionDB = "jbdc:sqlserver://localhost\SQLEXPRESS;database=" 
        String connectionDB = "jbdc:sqlserver://LAPTOP-2V4ND64M\SQLEXPRESS;database=" 
                //+ dbName + ";user = " + user + ";password = " + pass + ";";
                + dbName + ";integratedSecurity=true;";
        connection = DriverManager.getConnection(connectionDB);            
    }

    /*catch(Exception e) {
        System.out.println("Error: " + e.getMessage());
    }*/
    catch(SQLException e) {
        System.out.println("Error: " + e.getMessage());
    }
    catch(Exception e) {
        System.out.println("Error: " + e.getMessage());
    }

    return connection;
}

public static void main(String[] args) {
    if(DBtienda.getConnection() != null)
        System.out.println("Conexión exitosa!");
}

}

This is the complete error

Error: Not suitable driver found for jbdc: sqlserver: // LAPTOP-2V4ND64M \ SQLEXPRESS; database = store; integratedSecurity = true;

    
asked by Omar Bang 22.11.2018 в 05:50
source

2 answers

0

You should check:

  • If the MS SQL Server service is started (In windows services.msc).
  • How do you enter the server? SA user? o Windows credentials? if it is with windows credentials, it goes integratedSecurity = true and if it is not user = sa; password = TU_PASSWORD in the connection URL.

Greetings!

    
answered by 22.11.2018 в 16:37
0

It's simple you need the autorization dirver for the sql

" link "

Download and put it in your folder depending on the version you use 64 or 32 bits

    
answered by 30.11.2018 в 15:29