Download the jdbc connector from mysql website.
Copy to project folder and set the CLASSPATH.
Source codes:
mysql> SHOW DATABASES;
mysql> CREATE DATABASE employees;
mysql> USE employees;
CREATE TABLE IF NOT EXISTS emp (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
age TINYINT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;
mysql> SELECT * FROM emp;
mysql> DESCRIBE emp;
mysql> SHOW TABLES;
mysql> INSERT INTO emp(name, age) VALUES('Fahad', 18);
mysql> exit
Java Source Code:
https://bdjunayed.visualstudio.com/SampleJFrameExample