Java realizes real-time monitoring of MySQL database changes MySQLBinListener

Directory 1. Export the required classes and interfaces 2. Define the MySQLBinlogListener class 3. Private method to start the reconnection timer 4. Complete code Write a listener for real-time changes to the MySQL database. Why write this listener: In order to monitor and respond to change events in the MySQL database in real time Real-time […]

MySQL data export csv file – a lot

Recently, I encountered a demand for downloading files. Exporting the data in mysql to a file in csv format should be quite simple. However, the amount of data is too large, and there are millions of data in the table. Conditions of hundreds of thousands of data. Step 1: To optimize the sql index, return […]

Efficient solution: It only takes 13 seconds to insert 300,000 pieces of data into MySQL

Click to follow the official account, Java dry goodsdelivered in time This article mainly describes the cases and results of large data volume data insertion through MyBatis, JDBC, etc. 300,000 pieces of data are inserted into the database for verification Entity class, mapper and configuration file definition User entity mapper interface mapper.xml file sqlMapConfig.xml […]

Lock mechanism and principle of MySql database

MySQL is a popular relational database management system widely used in various web applications and enterprise applications. In MySQL, a lock is a mechanism for controlling concurrent access, which can ensure data consistency and integrity. This article will introduce the locking mechanism and principle of MySQL, including the type, level and implementation principle of the […]

C++ self-service order program based on MySQL

One, system function 1. View menu details 2. Add dishes to the shopping cart 3. Remove the dish from the shopping cart 4. View my shopping cart details 5. Empty my shopping cart dishes 6. Menu administrator authentication 7. Admin option: add dishes to the menu 8. Admin option: delete dishes from the menu Note: […]

Mysql storage time, corresponding to Api and corresponding java properties

1. Mysql storage time type Commonly used types of time/date storage: DATE: Only used to store date values (year, month, day) in the format ‘YYYY-MM-DD’. TIME: Only used to store time values (hours, minutes, seconds) in the format ‘HH:MM:SS’. DATETIME: used to store date and time values at the same time, the format is ‘YYYY-MM-DD […]

MySQL index optimization practice & EXPLAIN analysis

Let’s introduce the specific business scenario first When the user logs in, he needs to view the courses that he can learn. Different users see different courses. The courses have permissions. The permissions are controlled by the following lesson_user_permissions table, where sys_user_id and lesson_id are used as the joint primary key There is also a […]

Realize timed task parsing headerless .csv file into pgsql library (java, SpringBoot)

1. Scheduled tasks package; import; import; import; import; import; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.stereotype.Component; import; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author stb * @date 2023-05-24 * @description Synchronize XXX data regularly */ @Slf4j @Component […]

PostgreSQL source code deployment

Article directory illustrate 1. Preparations 1.1 Source package download 1.2 Unzip the installation directory 1.3 Install dependent packages 1.4 Add user 1.5 Create a data directory 2. Compile and install 2.1 Source code compilation 2.2 Configure environment variables 2.3 Initialize the database 2.4 Start the database 2.5 Connect to the database 3. Parameter adjustment 3.1 […]