How Can I Obtain Mysql Connector Java Maven Dependency
I Have Downloaded Mysql Workbench for My Database, and Intellij for the Jdbc. However, While Watching a Tutorial, It Was Mentioned That I Need the Mysql...
I have downloaded MySQL Workbench for my database, and IntelliJ for the JDBC. However, while watching a tutorial, it was mentioned that I need the MySQL dependency in a pom.xml file. Any idea on how to obtain that?
2 Answers
To connect to a MySQL database server from a Java app, you need a JDBC driver. The MySQL Connector/J product is one such JDBC driver.
You can obtain MySQL Connector/J via Maven. Look at a Maven repository for the <dependency> XML fragment. Copy-paste that within the <dependencies> tag of your POM file.
For example, look at MvnRepository.com.
<!-- -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.24</version>
</dependency>
Just add the MySQL dependency in pom.xml files
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.24</version>
</dependency>