Using JDBC on Linux

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.

Operating environment

CentOS 7 JDK 1.8.0_171 MySQL 5.7

JDBC introduction

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

Using JDBC on Linux
Try using Spring JDBC
Using Flutter on Ubuntu (Part 2)
Downgrade Java on openSUSE Linux
Install rbenv on Amazon Linux
Install java 1.8.0 on Amazon linux2
How to get started with JDBC using PostgresSQL on MacOS
Using Java on OSX 10.15 (Catalina) β
Using Azure IOT Hub on Ubuntu 20.10.
Try using Redmine on Mac docker
Install ngrok on ubuntu16.04 using Vagrant
Install Ruby 2.5 on CentOS 7 using SCL
Installed on Lombok Mac (using STS)
Save ArrayList using GSON on Android
Using Docker on Windows10 Home WSL2
Using a local network on iOS 14
Installing and using Ansible on Ubuntu 16.04
[Ruby on Rails] Code check using Rubocop-airbnb
Try using the service on Android Oreo
Using JupyterLab + Java with WSL on Windows 10
Notes on operators using Java ~ String type ~
Sobel filter using OpenCV on Android (Java)
Notes on using FCM with Ruby on Rails
[Ruby on Rails] Image slideshow using Skippr
Install Java8 with Yum on Amazon Linux
Java and Derby integration using JDBC (using NetBeans)
Send an email using JavaMail on AWS
How to install kafkacat on Amazon Linux2