一.背景
要做数据模拟,需要在测试环境创建7千万的流水数据,进行迁移的模拟动作。
二.具体代码
private static final String DB_URL = "jdbc:mysql://IP:3306/twallet_dev?zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useAffectedRows=true&rewriteBatchedStatements=true";
private static final String USER = "root";
private static final String PASS = "123456";
private static final String TABLE_NAME = "tstd_jour_copy1";
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static final DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyyMMdd");
private SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker(0,0);
public void testinsert() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
String sql = "INSERT INTO " + TABLE_NAME + " (`code`, `type`, `user_id`, `account_number`, `account_type`, `currency`, `biz_type`, `biz_note`, `en_biz_note`, `trans_object`, `trans_object_user_id`, `trans_amount`, `pre_amount`, `post_amount`, `status`, `push_status`, `channel_type`, `channel_order`, `prev_jour_code`, `ref_no`, `remark`, `create_datetime`, `work_date`, `check_user`, `check_note`, `check_datetime`, `adjust_user`, `adjust_note`, `adjust_datetime`, `trans_order_no`, `subsidiary_code`)" +
" VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

最低0.47元/天 解锁文章
7343

被折叠的 条评论
为什么被折叠?



