|
Worldwide
mysql-connector-java-8.0.25.jar download
Driver/File Download

– Add to pom.xml :

<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.25</version> </dependency> – Add to build.gradle :

import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class MySQLTest public static void main(String[] args) String url = "jdbc:mysql://localhost:3306/your_database"; String user = "your_username"; String password = "your_password";

// Note: Driver registration is automatic with JDBC 4+ try (Connection conn = DriverManager.getConnection(url, user, password)) System.out.println("Connected to MySQL successfully!"); catch (SQLException e) System.err.println("Connection failed: " + e.getMessage());

This website will use cookies and similar technologies to enhance the user experience and to maintain as smooth a service as possible for each visitor. For more information, please visit our Cookies Policy
By clicking on the 'X' button, you agree to our use of Cookies this time