JDBC is a library for operating MySQL via JAVA. I've heard that it's not used in practice, but I've introduced it so I'll write it down.
CentOS 7 JDK 1.8.0_171 MySQL 5.7
Get the JDBC driver from the site.
wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.30.tar.gz -O mysql-connector.tar.gz
Defrost
tar -xvzf mysql-connector.tar.gz
Bring the jar file with the driver to the same level as the program. (Because it is troublesome to specify the classpath)
cp mysql-connector-java-5.1.30/mysql-connector-java-5.1.30-bin.jar mysql-connector.jar
All you have to do is compile the program with the specified classpath. Here, test.java is a program that uses JDBC.
javac -classpath mysql-connector.jar test.java
java -classpath mysql-connector.jar: test
Recommended Posts