package org.kodejava.example.jdbc;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JDBCCompliant {
private static final String URL = "jdbc:mysql://localhost/kodejava";
public static void main(String[] args) {
try {
Driver driver = DriverManager.getDriver(URL);
// Check if the driver is a genuine JDBC compliant driver.
if (driver.jdbcCompliant()) {
System.out.println("A genuine JDBC compliant driver");
} else {
System.out.println("Not a genuine JDBC compliant driver");
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
Maven dependencies
<!-- https://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/8.0.17/mysql-connector-java-8.0.17.jar -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
Wayan Saryada
Founder at Kode Java Org
I am a programmer, a runner, a recreational diver, currently live in the island of Bali, Indonesia. Mostly programming in Java, Spring Framework, Hibernate / JPA. If these posts help, you can support me, buy me a cup of coffee or tea. Thank you 🥳
Latest posts by Wayan Saryada (see all)
- How do I set the time of java.util.Date instance to 00:00:00? - October 24, 2019
- How to Install Consolas Font in Mac OS X? - March 29, 2019
- How do I clear the current command line in terminal? - February 14, 2019