No suitable driver found for jdbc ошибка

I’m getting this exception when I try to run this program. It’s one of the Microsoft examples. I’ve added the sqljdbc4.jar to the classpath in netbeans for both compile and Run, via the project properties. I also tested that the class could be found by using an import statement below — no error during compile, so it must be finding the jar.

Could it be related to a dll or some sql dll that the sqldbc4.jar references?

This is the exact exception, and below is the exact code, except for password.

Exception:

run:
java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433;databaseName=HealthCareDatabase
Error Trace in getConnection() : No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433;databaseName=HealthCareDatabase
Error: No active Connection
    at java.sql.DriverManager.getConnection(DriverManager.java:602)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at javaapplication1.Connect.getConnection(Connect.java:35)
    at javaapplication1.Connect.displayDbProperties(Connect.java:50)
    at javaapplication1.JavaApplication1.main(JavaApplication1.java:23)
BUILD SUCCESSFUL (total time: 1 second)

Code:

 package javaapplication1;
import com.microsoft.sqlserver.jdbc.SQLServerDriver;

import java.*;

public class Connect {

    private java.sql.Connection con = null;
    private final String url = "jdbc:microsoft:sqlserver://";
    private final String serverName = "localhost";
    private final String portNumber = "1433";
    private final String databaseName = "HealthCareDatabase";
    private final String userName = "larry";
    private final String password = "xxxxxxx";

    // Constructor
    public Connect() {
    }

    private String getConnectionUrl() {
        return url + serverName + ":" + portNumber + ";databaseName=" + databaseName ;
    }

    private java.sql.Connection getConnection() {
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            con = java.sql.DriverManager.getConnection(getConnectionUrl(), userName, password);
            if (con != null) {
                System.out.println("Connection Successful!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Error Trace in getConnection() : " + e.getMessage());
        }
        return con;
    }

    public void displayDbProperties() {
        java.sql.DatabaseMetaData dm = null;
        java.sql.ResultSet rs = null;
        try {
            con = this.getConnection();
            if (con != null) {
                dm = con.getMetaData();
                System.out.println("Driver Information");
                System.out.println("tDriver Name: " + dm.getDriverName());
                System.out.println("tDriver Version: " + dm.getDriverVersion());
                System.out.println("nDatabase Information ");
                System.out.println("tDatabase Name: " + dm.getDatabaseProductName());
                System.out.println("tDatabase Version: " + dm.getDatabaseProductVersion());
                System.out.println("Avalilable Catalogs ");
                rs = dm.getCatalogs();
                while (rs.next()) {
                    System.out.println("tcatalog: " + rs.getString(1));
                }
                rs.close();
                rs = null;
                closeConnection();
            } else {
                System.out.println("Error: No active Connection");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        dm = null;
    }

    private void closeConnection() {
        try {
            if (con != null) {
                con.close();
            }
            con = null;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) throws Exception {
        Connect myDbTest = new Connect();
        myDbTest.displayDbProperties();
    }

}

Piyush Mattoo's user avatar

asked Apr 11, 2011 at 4:56

Larry Watanabe's user avatar

Larry WatanabeLarry Watanabe

10.1k9 gold badges42 silver badges46 bronze badges

3

Your URL should be jdbc:sqlserver://server:port;DatabaseName=dbname
and Class name should be like com.microsoft.sqlserver.jdbc.SQLServerDriver
Use MicrosoftSQL Server JDBC Driver 2.0

answered Apr 11, 2011 at 5:38

Piyush Mattoo's user avatar

Piyush MattooPiyush Mattoo

15.3k6 gold badges47 silver badges56 bronze badges

4

For someone looking to solve same by using maven. Add below dependency in POM:

<dependency>
    <groupId>com.microsoft.sqlserver</groupId>
    <artifactId>mssql-jdbc</artifactId>
    <version>7.0.0.jre8</version>
</dependency>

And use below code for connection:

String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=master;user=sa;password=your_password";

try {
    System.out.print("Connecting to SQL Server ... ");
    try (Connection connection = DriverManager.getConnection(connectionUrl))        {
        System.out.println("Done.");
    }
} catch (Exception e) {
    System.out.println();
    e.printStackTrace();
}

Look for this link for other CRUD type of queries.

answered Aug 31, 2018 at 9:16

Shams's user avatar

1

Following is a simple code to read from SQL database.
Database names is «database1».
Table name is «table1».
It contain two columns «uname» and «pass».
Dont forget to add «sqljdbc4.jar» to your project. Download sqljdbc4.jar

public class NewClass {

    public static void main(String[] args) {

        Connection conn = null;
        String dbName = "database1";
        String serverip="192.168.100.100";
        String serverport="1433";
        String url = "jdbc:sqlserver://"+serverip+"\SQLEXPRESS:"+serverport+";databaseName="+dbName+"";
        Statement stmt = null;
        ResultSet result = null;
        String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
        String databaseUserName = "admin";
        String databasePassword = "root";
        try {
            Class.forName(driver).newInstance();
            conn = DriverManager.getConnection(url, databaseUserName, databasePassword);
            stmt = conn.createStatement();
            result = null;
            String pa,us;
            result = stmt.executeQuery("select * from table1 ");

            while (result.next()) {
                us=result.getString("uname");
                pa = result.getString("pass");              
                System.out.println(us+"  "+pa);
            }

            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

MarAvFe's user avatar

MarAvFe

4384 silver badges15 bronze badges

answered Jun 27, 2012 at 4:44

Fathah Rehman P's user avatar

Fathah Rehman PFathah Rehman P

8,3414 gold badges40 silver badges42 bronze badges

4

I was having the same error, but had a proper connection string. My problem was that the driver was not being used, therefore was optimized out of the compiled war.

Be sure to import the driver:

import com.microsoft.sqlserver.jdbc.SQLServerDriver;

And then to force it to be included in the final war, you can do something like this:

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

That line is in the original question. This will also work:

SQLServerDriver driver = new SQLServerDriver();

answered Dec 28, 2017 at 16:59

JeffryHouser's user avatar

JeffryHouserJeffryHouser

39.4k4 gold badges37 silver badges59 bronze badges

You can try like below with sqljdbc4-2.0.jar:

 public void getConnection() throws ClassNotFoundException, SQLException, IllegalAccessException, InstantiationException {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
        String url = "jdbc:sqlserver://<SERVER_IP>:<PORT_NO>;databaseName=" + DATABASE_NAME;
        Connection conn = DriverManager.getConnection(url, USERNAME, PASSWORD);
        System.out.println("DB Connection started");
        Statement sta = conn.createStatement();
        String Sql = "select * from TABLE_NAME";
        ResultSet rs = sta.executeQuery(Sql);
        while (rs.next()) {
            System.out.println(rs.getString("COLUMN_NAME"));
        }
    }

answered Jul 26, 2017 at 16:10

shivam srivastava's user avatar

Try append the archive .JAR in Libraries Into The NETBEANS Project . Attention: The Project Category must be «Ant»

answered Sep 20, 2022 at 14:43

Ita's user avatar

In this post, we will see how to resolve java.sql.SQLException: No suitable driver found for JDBC.

There can be multiple reasons for this exception and let’s see it one by one.

connector jar is not on classpath

you need make sure you have connector jar on classpath.

For example:
If you are using mysql to connect to database, then mysql-connector-java jar should on classpath.

You can add the maven dependency as below:

<! https://mvnrepository.com/artifact/mysql/mysql-connector-java —>

<dependency>

    <groupId>mysql</groupId>

    <artifactId>mysqlconnectorjava</artifactId>

    <version>8.0.19</version>

</dependency>

You can find versions of jar over here.

Jar not present in Tomcat/JBoss lib

If you are using web servers such as tomcat or JBoss, then you should put the connector jar in server lib folder.

For example:
In case you are using tomcat and mysql, you should put mysql-connector-java in $CATALINA_HOME/lib.

Actually, the connection pool needs to be set up before application is instantiated. This could be the reason, you need to put jar in server lib folder.

If you are using eclipse to run tomcat, then eclipse won’t pick $CATALINA_HOME/lib.
You can fix this issue in two ways:

  • Click on Open Launch Config -> classpath tab to set mysql-connector-java jar on classpath.
  • Go to server tab and select option Use Tomcat installation

Typo in connection url

This exception can also arise if you have typo in your jdbc url.

For example:
Let’s say if you have jdbc URL as below.

jdbc:mysql//localhost:3307/dbname

If you notice closely, we are missing : after mysql and URL should be

jdbc:mysql://localhost:3307/dbname

Did not call class.forName() [old java versions]

If you are using java version less than 6 or did not use JDBC 4.0 compliant connector jar, then you can get this exception.
You need to register driver before calling DriverManager.getConnection();

Let’s understand with the help of example:

Connection con = null;

try {

    con = DriverManager.getConnection(«jdbc:mysql//localhost:3307/dbname»);

} catch (SQLException e) {

    throw new RuntimeException(e);

}

Above code will give error because we did not call Class.forName() before calling DriverManager.getConnection().

You can fix the error with:

Connection con = null;

try {

    //registering the jdbc driver here

    Class.forName(«com.mysql.jdbc.Driver»);  

    con = DriverManager.getConnection(«jdbc:mysql//localhost:3307/dbname»);

} catch (SQLException e) {

    throw new RuntimeException(e);

}

If you are using Java 6 or above and the latest version of mysql-connector-java, then you should not get this exception because of Class.forName()

Conclusion

As you can see, there can be multiple reason for getting java.sql.SQLException: No suitable driver found for JDBC. You need to identify which can applicable in your application.

That’s all about how to fix no suitable driver found for jdbc error. If you are still facing this issue, please comment.

java.sql.SQLException: No suitable driver found for 
There are two ways to connect Microsoft SQL Server from Java program, either by using Microsoft’s official JDBC driver (sqljdbc4.jar) or by using jTDS driver (jtds.jar). This error comes when your supplied database URL didn’t match with the JDBC driver present in the CLASSPATH. Many programmers who usually use jtds.jar, make a mistake while using sqljdbc4.jar by adding «microsoft» in JDBC URL. That makes URL invalid and JDBC API throws «java.sql.SQLException: No suitable driver: sqljdbc4.jar» error.

For Example in JTDS, the JDBC URL format is

jdbc:jtds:://[:][/][;=[;…]]

and while using Microsoft’s JDBC driver, the URL format is :

jdbc:sqlserver://[serverName[instanceName][:portNumber]][;property=value[;property=value]]

where jdbc:sqlserver string is mandatory because it’s used to identify JDBC drive. It is also known as sub-protocol. All other parameters e.g. serverName, instanceName, and portNumber is optional.

If you don’t provide serverName then the SQL server will look into properties collection, if an instance is not specified then JDBC will connect to default instance and if the port number is not specified then it will connect to default SQL Server port number 1433.

java.sql.SQLException: No suitable driver found for jdbc:jtds

Btw, if you are new to JDBC then I also recommend you join a comprehensive online course to learn JDBC from scratch. If you need a recommendation then you can take a look at these best Java courses on Udemy. You will learn the right ways of doing things with respect to Java and the database.

4 Common reasons for «No suitable driver found» Error for SQL Server Database 

Let’s see some of the most common reasons for getting java.sql.SQLException: No suitable driver found for jdbc: error while connecting to Microsoft SQL Server database

1. Difference Drivers 

You are using JDBC URL format for jTDS driver (jdbc:jtds://localhost:1434″;)  but deployed sqljdbc4.jar in CLASSPATH. In this case, you will get the following error :

java.sql.SQLException: No suitable driver found for jdbc:jtds:
//localhost:1434
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)

In order to solve this error, just add jtds.jar in CLASSPATH of your Java application. If you don’t have jtds.jar, you can download it from here. Alternatively, you can also add the following Maven dependency, if you are using Maven to build your project :

<dependency>
   <groupId>net.sourceforge.jtds</groupId>
   <artifactId>jtds</artifactId>
   <version>1.3.1</version>
</dependency>

If you already have this JAR file in your CLASSPATH but still getting the above error, maybe it’s time to revisit your CLASSPATH settings. See Core Java, Volume II—Advanced Features by Cay S. Horstmann to learn more about JDBC drivers and URL.

2. Wrong JDBC Driver Name

Many junior programmers make the mistake of including «microsoft» in JDBC URL for SQL SERVER like  «jdbc:microsoft:sqlserver://localhost:1433», while using sqljdbc4.jar file to connect MSSQL database. This will result in the following exception :

java.sql.SQLException: No suitable driver found 
    for jdbc:microsoft:sqlserver://localhost:1433
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)

In order to fix this error just remove microsoft from URL. Correct JDBC URL format to connect SQL SERVER is «jdbc:sqlserver://localhost:1433»;.  No need to worry about CLASSPATH, because if the SQLJDBC4.jar is not present then it will give you a different error, something like java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver.

3.  Spelling Mistakes in specifying Driver Name

The third common reason for the No suitable driver found the error is a spelling mistake. For example, if you are using jTDS driver to connect SQL Server database but given JDBC URL like «jdbc:jdts://localhost:1434». It’s very difficult to spot that instead of writing «jtds», you have written «jdts». I have seen this error many times, only to realize it after spending hours checking CLASSPATH settings.  You will be greeted with the following error :

java.sql.SQLException: No suitable driver found 
for jdbc:jdts://localhost:1434
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)

Solving this error is easy, just correct the spelling in JDBC URL and you are done.

4.  jTDS vs JDBC Drive 

The fourth reason for getting No suitable driver found an error while connecting to MSSQL is specifying JDBC URL as «jdbc:sqlserver://localhost:1433» but deployed jTDS driver in application’s CLASSPATH. This happens because many developers use jTDS driver in the development environment and Microsoft JDBC driver (sqljdbc4.jar) in the production environment.

java.sql.SQLException: No suitable driver found 
for jdbc:sqlserver://localhost:1433
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)

In order to solve that error, just remove the jTDS driver and add Microsoft JDBC driver i.e. sqljdbc4.jar in your project’s build path.

That’s all about how to solve java.sql.SQLException: No suitable driver found for jdbc: XXX error in Java. The root cause of this problem is the incorrect JDBC URL, mostly the protocol part is incorrect. This is not just a Microsoft SQL Server specific error but can come while connecting to any database like MySQL using JDBC API. You must make sure that JDBC URL is absolutely correct as instructed by the driver manual.

Further Resources to Learn JDBC in Java :

  • Step by Step Guide to connect MySQL database using JDBC API (guide)
  • Java guide to connect Oracle 10g database using JDBC thin driver (guide)
  • Solving java.lang.classnotfoundexception sun.jdbc.odbc.jdbcodbcdriver [solution]
  • Fixing java.lang.ClassNotFoundException: org.postgresql.Driver [solution]
  • Solving java.lang.classnotfoundexception oracle.jdbc.driver.oracledriver [solution]
  • Dealing with java.lang.ClassNotFoundException: com.mysql.jdbc.Driver [fix]

No suitable driver found for JDBC is an exception in Java that generally occurs when any driver is not found for making the database connectivity. In this section, we will discuss why we get such an error and what should be done to get rid of this exception so that it may not occur the next time.

No Suitable Driver Found For JDBC

Before discussing the exception, we should take a brief knowledge that what is a JDBC Driver.

What is a JDBC Driver

The JDBC (Java Database Connectivity) Driver is a driver that makes connectivity between a database and Java software. The JDBC driver can be understood as a driver that lets the database and Java application interact with each other. In JDBC, there are four different types of drivers that are to be used as per the requirement of the application. These JDBC divers are:

No Suitable Driver Found For JDBC

  1. JDBC-ODBC bridge driver
  2. Thin Layer driver
  3. Native API driver
  4. Network Protocol Driver

All four drivers have their own usage as well as pros and cons. To know more about JDBC Drivers, do visit: https://www.javatpoint.com/jdbc-driver section of our Java tutorial.

What is the Error and Why it Occurs?

Generally, «no suitable driver found» refers to throwing an error, i.e., «java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test» in the console. The error occurs when we are trying to connect to the MySql (or any other) database that is existing on your local machine, i.e., localhost, and listens to the specified port number which is set for the mysql and it founds that either no JDBC driver was registered before invoking the DriverManager.getConnection () method or we might not have added the MySQL JDBC driver to the classpath in the IDE. In case we are running a simple Java code with no requirement of database connectivity, the Java API executes it correctly and well, but if there is the need for a JDBC driver, an error is thrown, which is the «class not found» error. In simple words, such an error is thrown when no suitable driver is found by the Java API so that it could connect the Java application to the database.

How to remove the error

Now the question is how to get rid of such error. In order to resolve the problem or error, one needs to add the MYSQL Connector JAR to the classpath because the classpath includes the JDBC Driver for the MYSQL through which the connection is generated between the Java code and the database. In order to add the MYSQL connector JAR file to the IDE or tool we are using, we need to go through some quite simple steps. These steps are as follows:

For Eclipse and NetBeans IDE

1) Open any internet browser on the system and search for MySQL Connector download in the search tab. Several downloading links will appear. Click on the MYSQL website https://www.mysql.com/products/connector/ from it and download the latest version of the MYSQL connector by selecting your system specs.

No Suitable Driver Found For JDBC

2) After the successful download of the MYSQL Connector, it will be seen at the default Downloads folder of your system, as you can see in the below snippet:

No Suitable Driver Found For JDBC

3) Now, open the IDE you are working upon, either NetBeans or Eclipse, and also any other tool/IDE, whichever you use. Here, we have used Eclipse IDE.

4) Go to your project and right-click on it. A list of options will appear. Select and click on Build Path > Configure Build Path, and the Java Build Path dialog box will open up, as you can see in the below snippet:

No Suitable Driver Found For JDBC

5) Click on Add External JARs and move to the location where you have downloaded the Mysql Connector, as you can see in the below snippet:

No Suitable Driver Found For JDBC

6) Select the Mysql Connector and click on Open. The JAR file will get added to your project build path, as you can see in the below snippet:

No Suitable Driver Found For JDBC

7) Click on Apply and Close, and the JDBC Driver will be added to your Eclipse IDE.

8) Run the JDBC connection code once again, and this time you will not get the «No suitable driver found for JDBC» exception instead of other errors if you made any other syntax problem.

9) The JDBC Driver will get connected successfully, and the connection will get established successfully.

Note: If you want to know how to make JDBC Connectivity in Java, visit https://www.javatpoint.com/example-to-connect-to-the-mysql-database

Point to be noted:

  • If you are using Java SE 6 with JDBC 4.0, then you may not require to load and register the driver because the new Java feature provides autoloading of the JDBC driver class. Due to which there is no requirement of using Class.forName(«com.mysql.jdbc.Driver»); statement. However, if the JDBC Jar you are using is old, i.e., JDBC 4.0 compliant with Java SE 6, then you may need to create this statement.
  • In brief, we can say that such an error occurs when no JDBC JAR file is added to the classpath of Java. Just we need to add the JAR file to the classpath and then execute the code. The code will hopefully get executed with success.

The java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb exception occurs if the suitable driver is not found to connect mysql database from java application. The MySQL JDBC driver is not loaded in java either because the driver jar is not available in the class path, or because it is not possible to load the mysql driver jar. If no suitable driver is found in the java class path, the exception java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb will be thrown.

The MySQL JDBC driver is used to connect your Java application to a MySQL database. The mysql driver sends the database query from java to the database. The Mysql database executes the query and returns the results. The MySQL JDBC driver receives the data from the MySQL database and sends it back to the Java application.

If the MySQL JDBC driver is not loaded, the Java program will throw the exception java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb.

Exception

The stack trace of the exception will be shown as shown below. The exception java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb  is due to the driver class not loaded in java.

Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb
	at java.sql.DriverManager.getConnection(DriverManager.java:689)
	at java.sql.DriverManager.getConnection(DriverManager.java:247)
	at com.yawintutor.DBConnection.main(DBConnection.java:13)

How to reproduce this exception

If the Java application can not load the MySQL JDBC driver class or the MySQL JDBC class is not available in the Java class path, the exception java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/testdb will be thrown. This exception will be reproduced in the example below.

package com.yawintutor;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConnection {
	public static void main(String[] args) throws Exception {
		String url = "jdbc:mysql://localhost:3306/testdb";
		String username = "root";
		String password = "root";

		Connection con = DriverManager.getConnection(url, username, password);
		if (con != null) {
			System.out.println("Database Connected successfully");
		} else {
			System.out.println("Database Connection failed");
		}
	}
}

Solution 1

If the MySQL JDBC driver jar is available in the class path and the driver class is unable to load, the driver class must be loaded in the java using class.forName() method. The forName() method will load the class from the fully qualified class name specified as an argument. The example below demonstrates how to load the MySQL JDBC driver class using the class.forName() method.

package com.yawintutor;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConnection {
	public static void main(String[] args) throws Exception {
		Class.forName("com.mysql.cj.jdbc.Driver");
		String url = "jdbc:mysql://localhost:3306/testdb";
		String username = "root";
		String password = "root";

		Connection con = DriverManager.getConnection(url, username, password);
		if (con != null) {
			System.out.println("Database Connected successfully");
		} else {
			System.out.println("Database Connection failed");
		}
	}
}

Solution 2

If you are using mysql database version till 5.x.x, the MySQL JDBC driver “com.mysql.cj.jdbc.Driver” will not be available. For the older mysql databases the driver class “com.mysql.jdbc.Driver” must be used. The java program will be as like below.

package com.yawintutor;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConnection {
	public static void main(String[] args) throws Exception {
		Class.forName("com.mysql.jdbc.Driver");
		String url = "jdbc:mysql://localhost:3306/testdb";
		String username = "root";
		String password = "root@123";

		Connection con = DriverManager.getConnection(url, username, password);
		if (con != null) {
			System.out.println("Database Connected successfully");
		} else {
			System.out.println("Database Connection failed");
		}
	}
}

Solution 3

If the MySQL JDBC driver jar is not available in the java class path, download the mysql driver jar from https://dev.mysql.com/downloads/connector/j/. The name of mysql driver jar is same as mysql-connector-java-8.0.20.jar. Add the jar to the java class path.

download the jar mysql-connector-java-8.0.20.jar from https://dev.mysql.com/downloads/connector/j/ 
( 
  goto https://dev.mysql.com/downloads/connector/j/
  select "Select Operating System:" as your operating system and install
      or
  select "Select Operating System:" as "Platform Independent", download the zip and extract
)

Add in your java project.

In eclipse
Right click in mysql-connector-java-8.0.20.jar -> Build Path -> Add to Build Path

Solution 4

If the java project is a maven project, add the mysql connector dependency in the pom.xml. The dependency will download the mysql-connector-java-8.0.22.jar in the repository and link to the project. The latest mysql connector dependency can be found in https://mvnrepository.com/artifact/mysql/mysql-connector-java

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.22</version>
</dependency>

Solution 5

If the java project is build using the Gradle, add the dependency as below. When the project is build, the MySQL JDBC driver will be added to the java project.

dependencies {
    compile 'mysql:mysql-connector-java:8.0.22'
}

Понравилась статья? Поделить с друзьями:
  • No such ship design stellaris ошибка
  • No such node general самп ошибка
  • No such instance ошибка snmp 223
  • No such file or directory python ошибка
  • No such file or directory git bash ошибка