This is an example of Spring Boot Integration JDBC usage by using java configration.
- Create database:
mysql> CREATE DATABASE IF NOT EXISTS `db_example` CHARACTER SET utf8 COLLATE utf8_general_ci;
- Create database user:
mysql> CREATE USER 'springuser'@'localhost' IDENTIFIED BY 'ThePassword';
- Grant permission to database user:
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER,REFERENCES,CREATE VIEW ON `db_example`.* TO 'springuser'@'localhost';
- Create table:
mysql> use db_example;
mysql> CREATE TABLE foo (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL COMMENT '名称',
status TINYINT DEFAULT 0,
PRIMARY KEY (id)
);
- Load initial data:
mysql> INSERT INTO foo (name) VALUES
('dog'),('cat'),('penguin'),
('lax'),('whale'),('ostrich');
-
Load the project in IDE or vscode
-
Run the project in IDE
The project will query foo table in every 3 seconds, and mark them as read.