mysql implementation of read-write separation with java driver

The separation of reading and writing and load balancing of MySQL database are generally realized by the third-party software. It can also be implemented through MySQL driver, such as com.mysql.jdbc.ReplicationDriver. Website: Multi host connection configuration 1. Primary / secondary configuration 2. Load connection configuration 3. Primar ...

Posted on Fri, 01 May 2020 17:51:18 -0400 by waterox

JAVA meets HTML JSP (VII. Project case)

General introduction of the project Case: the realization of commodity browsing record Model 1 (Jsp+Javabean) implementation Implement DBHelper class Create entity class Create business logic class (DAO) Create page layer DBHelper class design First copy the package of the drive rack to the lib f ...

Posted on Fri, 01 May 2020 16:23:49 -0400 by cool-palace-ceo

The problem of inserting data into mysql to display garbled code

The problem of inserting data into mysql database to display garbled code When you are doing a java web project, sometimes you will encounter the problem of "random code"? "When you add a database to the database. The main solutions to this problem are as follows: First: make sure the character set fi ...

Posted on Fri, 01 May 2020 14:11:40 -0400 by Firestorm3d

Regular backup and restore of Mysql in Java

1, Scheduled backup of database Backup command Mysql backup instructions: 1. Specify database: mysqldump -h localhost -uroot -proot tuser>d:\user_2017-12-25_15-42-10.sql tuser: database name User? 2017-12-25? 15-42-10.sql: filename 2. Specify multiple tables in the database: mysqldump -h localhost -uroot -proot --databases tuser - ...

Posted on Fri, 01 May 2020 13:28:44 -0400 by DjMikeWatt

The implementation of Group get Top N method in SQL

The implementation of Group group get Top N method in SQL is reproduced from https://www.2cto.com/database/201303/194530.html There is a product table, which contains four fields: id, name, city and addtime. Because the report needs to be grouped by city, and the latest 10 products of each city are counted, 1 million data is inserted into the ...

Posted on Fri, 01 May 2020 11:56:51 -0400 by gregor171

mysql custom function (3) conditional control statement

1. if statement: drop function if exists hello; create function hello(a int) returns varchar (255) begin declare x varchar(255) default ' x '; select `name` into x from gl_dept where id = a; -- if start if x = 'Taobao online shop 2' THEN set x = '2'; elseif x = 'Taobao online shop 3' THEN set x = ...

Posted on Fri, 01 May 2020 11:58:22 -0400 by ericm

MySQL tuning Trilogy (3) PROFILE

Analyzing the cost of SQL execution is an important way to optimize SQL. MySQL can record the resource cost of SQL statements, such as IO, context switch, CPU, Memory, etc. by setting the profiling parameter Viewing the profiling system variable mysql> show variables like '%profil%'; +------------------------+-------+ | Variable_name ...

Posted on Fri, 01 May 2020 11:08:47 -0400 by Millar

Data source read write separation -- replication

MySql provides a simple read-write separation method - replication. First look at the specific demo package test1; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.Properties; import com.mysql.jdbc.Driver; import com.mysql.jdbc.ReplicationDriver;; public class Conn ...

Posted on Fri, 01 May 2020 08:52:56 -0400 by ik

Implementation of background advanced query (advanced version)

1 no previous code format optimization Commodity //The advanced query object of goods encapsulates the data of the advanced query form of goods. public class ProductQueryObject extends BaseQueryObject{ private List<String> conditions = new ArrayList<>(); //SQL for splicing query conditions p ...

Posted on Fri, 01 May 2020 07:30:34 -0400 by Frapster

MySQL 5.7 multi source replication configuration process

~~MySQL multi-source replication enables Slave to receive transactions from multiple direct masters in parallel. Multi source replication can be used to back up multiple servers to a single server, Merge Table shards, and merge data from multiple servers to a single server. When applying transactions, multi-source replication does not impleme ...

Posted on Fri, 01 May 2020 03:55:17 -0400 by lostsoul111455