change
This commit is contained in:
parent
c5b53e9700
commit
c623b4da7b
|
@ -29,11 +29,7 @@ public class JdbcTaosdemo {
|
|||
JdbcTaosdemoConfig config = new JdbcTaosdemoConfig(args);
|
||||
|
||||
boolean isHelp = Arrays.asList(args).contains("--help");
|
||||
if (isHelp) {
|
||||
JdbcTaosdemoConfig.printHelp();
|
||||
return;
|
||||
}
|
||||
if (config.getHost() == null) {
|
||||
if (isHelp || config.host == null || config.host.isEmpty()) {
|
||||
JdbcTaosdemoConfig.printHelp();
|
||||
return;
|
||||
}
|
||||
|
@ -85,7 +81,7 @@ public class JdbcTaosdemo {
|
|||
taosdemo.selectLastOneYear();
|
||||
|
||||
// drop super table
|
||||
if (config.isDeleteTable())
|
||||
if (config.dropTable)
|
||||
taosdemo.dropSuperTable();
|
||||
taosdemo.close();
|
||||
}
|
||||
|
@ -103,7 +99,7 @@ public class JdbcTaosdemo {
|
|||
logger.info("[ OK ] Connection established.");
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new RuntimeException("connection failed: " + config.getHost());
|
||||
throw new RuntimeException("connection failed: " + config.host);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +107,7 @@ public class JdbcTaosdemo {
|
|||
* create database
|
||||
*/
|
||||
private void createDatabase() {
|
||||
String sql = SqlSpeller.createDatabaseSQL(config.getDbName(), config.getKeep(), config.getDays());
|
||||
String sql = SqlSpeller.createDatabaseSQL(config.database, config.keep, config.days);
|
||||
execute(sql);
|
||||
}
|
||||
|
||||
|
@ -119,7 +115,7 @@ public class JdbcTaosdemo {
|
|||
* drop database
|
||||
*/
|
||||
private void dropDatabase() {
|
||||
String sql = SqlSpeller.dropDatabaseSQL(config.getDbName());
|
||||
String sql = SqlSpeller.dropDatabaseSQL(config.database);
|
||||
execute(sql);
|
||||
}
|
||||
|
||||
|
@ -127,7 +123,7 @@ public class JdbcTaosdemo {
|
|||
* use database
|
||||
*/
|
||||
private void useDatabase() {
|
||||
String sql = SqlSpeller.useDatabaseSQL(config.getDbName());
|
||||
String sql = SqlSpeller.useDatabaseSQL(config.database);
|
||||
execute(sql);
|
||||
}
|
||||
|
||||
|
@ -135,7 +131,7 @@ public class JdbcTaosdemo {
|
|||
* create super table
|
||||
*/
|
||||
private void createSuperTable() {
|
||||
String sql = SqlSpeller.createSuperTableSQL(config.getStbName());
|
||||
String sql = SqlSpeller.createSuperTableSQL(config.superTable);
|
||||
execute(sql);
|
||||
}
|
||||
|
||||
|
@ -144,9 +140,9 @@ public class JdbcTaosdemo {
|
|||
*/
|
||||
private void createTableMultiThreads() {
|
||||
try {
|
||||
final int tableSize = config.getNumberOfTable() / config.getNumberOfThreads();
|
||||
final int tableSize = (int) (config.numOfTables / config.numOfThreadsForCreate);
|
||||
List<Thread> threads = new ArrayList<>();
|
||||
for (int i = 0; i < config.getNumberOfThreads(); i++) {
|
||||
for (int i = 0; i < config.numOfThreadsForCreate; i++) {
|
||||
Thread thread = new Thread(new CreateTableTask(config, i * tableSize, tableSize), "Thread-" + i);
|
||||
threads.add(thread);
|
||||
thread.start();
|
||||
|
@ -169,9 +165,9 @@ public class JdbcTaosdemo {
|
|||
final long startDatetime = TimeStampUtil.datetimeToLong("2005-01-01 00:00:00.000");
|
||||
final long finishDatetime = TimeStampUtil.datetimeToLong("2030-01-01 00:00:00.000");
|
||||
|
||||
final int tableSize = config.getNumberOfTable() / config.getNumberOfThreads();
|
||||
final int tableSize = (int) (config.numOfTables / config.numOfThreadsForInsert);
|
||||
List<Thread> threads = new ArrayList<>();
|
||||
for (int i = 0; i < config.getNumberOfThreads(); i++) {
|
||||
for (int i = 0; i < config.numOfThreadsForInsert; i++) {
|
||||
Thread thread = new Thread(new InsertTableDatetimeTask(config, i * tableSize, tableSize, startDatetime, finishDatetime), "Thread-" + i);
|
||||
threads.add(thread);
|
||||
thread.start();
|
||||
|
@ -188,10 +184,10 @@ public class JdbcTaosdemo {
|
|||
|
||||
private void insertMultiThreads() {
|
||||
try {
|
||||
final int tableSize = config.getNumberOfTable() / config.getNumberOfThreads();
|
||||
final int numberOfRecordsPerTable = config.getNumberOfRecordsPerTable();
|
||||
final int tableSize = (int) (config.numOfTables / config.numOfThreadsForInsert);
|
||||
final int numberOfRecordsPerTable = (int) config.numOfRowsPerTable;
|
||||
List<Thread> threads = new ArrayList<>();
|
||||
for (int i = 0; i < config.getNumberOfThreads(); i++) {
|
||||
for (int i = 0; i < config.numOfThreadsForInsert; i++) {
|
||||
Thread thread = new Thread(new InsertTableTask(config, i * tableSize, tableSize, numberOfRecordsPerTable), "Thread-" + i);
|
||||
threads.add(thread);
|
||||
thread.start();
|
||||
|
@ -207,82 +203,82 @@ public class JdbcTaosdemo {
|
|||
}
|
||||
|
||||
private void selectFromTableLimit() {
|
||||
String sql = SqlSpeller.selectFromTableLimitSQL(config.getDbName(), config.getTbPrefix(), 1, 10, 0);
|
||||
String sql = SqlSpeller.selectFromTableLimitSQL(config.database, config.prefixOfTable, 1, 10, 0);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectCountFromTable() {
|
||||
String sql = SqlSpeller.selectCountFromTableSQL(config.getDbName(), config.getTbPrefix(), 1);
|
||||
String sql = SqlSpeller.selectCountFromTableSQL(config.database, config.prefixOfTable, 1);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectAvgMinMaxFromTable() {
|
||||
String sql = SqlSpeller.selectAvgMinMaxFromTableSQL("current", config.getDbName(), config.getTbPrefix(), 1);
|
||||
String sql = SqlSpeller.selectAvgMinMaxFromTableSQL("current", config.database, config.prefixOfTable, 1);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLastFromTable() {
|
||||
String sql = SqlSpeller.selectLastFromTableSQL(config.getDbName(), config.getTbPrefix(), 1);
|
||||
String sql = SqlSpeller.selectLastFromTableSQL(config.database, config.prefixOfTable, 1);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectFromSuperTableLimit() {
|
||||
String sql = SqlSpeller.selectFromSuperTableLimitSQL(config.getDbName(), config.getStbName(), 10, 0);
|
||||
String sql = SqlSpeller.selectFromSuperTableLimitSQL(config.database, config.superTable, 10, 0);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectCountFromSuperTable() {
|
||||
String sql = SqlSpeller.selectCountFromSuperTableSQL(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectCountFromSuperTableSQL(config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectAvgMinMaxFromSuperTable() {
|
||||
String sql = SqlSpeller.selectAvgMinMaxFromSuperTableSQL("current", config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectAvgMinMaxFromSuperTableSQL("current", config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectAvgMinMaxFromSuperTableWhereTag() {
|
||||
String sql = SqlSpeller.selectAvgMinMaxFromSuperTableWhere("current", config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectAvgMinMaxFromSuperTableWhere("current", config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLastFromSuperTableWhere() {
|
||||
String sql = SqlSpeller.selectLastFromSuperTableWhere("current", config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectLastFromSuperTableWhere("current", config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectGroupBy() {
|
||||
String sql = SqlSpeller.selectGroupBy("current", config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectGroupBy("current", config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLike() {
|
||||
String sql = SqlSpeller.selectLike(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectLike(config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLastOneHour() {
|
||||
String sql = SqlSpeller.selectLastOneHour(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectLastOneHour(config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLastOneDay() {
|
||||
String sql = SqlSpeller.selectLastOneDay(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectLastOneDay(config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLastOneWeek() {
|
||||
String sql = SqlSpeller.selectLastOneWeek(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectLastOneWeek(config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLastOneMonth() {
|
||||
String sql = SqlSpeller.selectLastOneMonth(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectLastOneMonth(config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
private void selectLastOneYear() {
|
||||
String sql = SqlSpeller.selectLastOneYear(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.selectLastOneYear(config.database, config.superTable);
|
||||
executeQuery(sql);
|
||||
}
|
||||
|
||||
|
@ -302,7 +298,7 @@ public class JdbcTaosdemo {
|
|||
* drop super table
|
||||
*/
|
||||
private void dropSuperTable() {
|
||||
String sql = SqlSpeller.dropSuperTableSQL(config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.dropSuperTableSQL(config.database, config.superTable);
|
||||
execute(sql);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
package com.taosdata.example.jdbcTaosdemo.domain;
|
||||
|
||||
import com.taosdata.example.jdbcTaosdemo.utils.TimeStampUtil;
|
||||
|
||||
public final class JdbcTaosdemoConfig {
|
||||
// instance
|
||||
public String host; //host
|
||||
public int port = 6030; //port
|
||||
public String user = "root"; //user
|
||||
public String password = "taosdata"; //password
|
||||
// database
|
||||
public String database = "test"; //database
|
||||
public int keep = 3650; //keep
|
||||
public int days = 30; //days
|
||||
public int replica = 1; //replica
|
||||
//super table
|
||||
public boolean doCreateTable = true;
|
||||
public String superTable = "weather"; //super table name
|
||||
public String prefixOfFields = "col";
|
||||
public int numOfFields;
|
||||
public String prefixOfTags = "tag";
|
||||
public int numOfTags;
|
||||
public String superTableSQL;
|
||||
//sub table
|
||||
public String prefixOfTable = "t";
|
||||
// insert task
|
||||
public boolean autoCreateTable = true;
|
||||
public long numOfTables = 100;
|
||||
public long numOfRowsPerTable = 100;
|
||||
public int numOfTablesPerSQL = 10;
|
||||
public int numOfValuesPerSQL = 10;
|
||||
public int numOfThreadsForCreate = 1;
|
||||
public int numOfThreadsForInsert = 1;
|
||||
public long startTime;
|
||||
public long timeGap = 1;
|
||||
public int frequency;
|
||||
public int order;
|
||||
public int rate = 10;
|
||||
public long range = 1000l;
|
||||
// select task
|
||||
|
||||
// drop task
|
||||
public boolean dropTable = false;
|
||||
|
||||
public static void printHelp() {
|
||||
System.out.println("Usage: java -jar jdbc-taosdemo-2.0.jar [OPTION...]");
|
||||
// instance
|
||||
System.out.println("-host The host to connect to TDengine which you must specify");
|
||||
System.out.println("-port The TCP/IP port number to use for the connection. Default is 6030");
|
||||
System.out.println("-user The TDengine user name to use when connecting to the server. Default is 'root'");
|
||||
System.out.println("-password The password to use when connecting to the server.Default is 'taosdata'");
|
||||
// database
|
||||
System.out.println("-database Destination database. Default is 'test'");
|
||||
System.out.println("-keep database keep parameter. Default is 3650");
|
||||
System.out.println("-days database days parameter. Default is 30");
|
||||
System.out.println("-replica database replica parameter. Default 1, min: 1, max: 3");
|
||||
// super table
|
||||
System.out.println("-doCreateTable do create super table and sub table, true or false, Default true");
|
||||
System.out.println("-superTable super table name. Default 'weather'");
|
||||
System.out.println("-prefixOfFields The prefix of field in super table. Default is 'col'");
|
||||
System.out.println("-numOfFields The number of field in super table. Default is (ts timestamp, temperature float, humidity int).");
|
||||
System.out.println("-prefixOfTags The prefix of tag in super table. Default is 'tag'");
|
||||
System.out.println("-numOfTags The number of tag in super table. Default is (location nchar(64), groupId int).");
|
||||
System.out.println("-superTableSQL specify a sql statement for the super table.\n" +
|
||||
" Default is 'create table weather(ts timestamp, temperature float, humidity int) tags(location nchar(64), groupId int). \n" +
|
||||
" if you use this parameter, the numOfFields and numOfTags will be invalid'");
|
||||
// sub table
|
||||
System.out.println("-prefixOfTable The prefix of sub tables. Default is 't'");
|
||||
System.out.println("-numOfTables The number of tables. Default is 1");
|
||||
System.out.println("-numOfThreadsForCreate The number of thread during create sub table. Default is 1");
|
||||
// insert task
|
||||
System.out.println("-autoCreateTable Use auto Create sub tables SQL. Default is false");
|
||||
System.out.println("-numOfRowsPerTable The number of records per table. Default is 1");
|
||||
System.out.println("-numOfThreadsForInsert The number of threads during insert row. Default is 1");
|
||||
System.out.println("-numOfTablesPerSQL The number of table per SQL. Default is 1");
|
||||
System.out.println("-numOfValuesPerSQL The number of value per SQL. Default is 1");
|
||||
System.out.println("-startTime start time for insert task, The format is \"yyyy-MM-dd HH:mm:ss.SSS\".");
|
||||
System.out.println("-timeGap the number of time gap. Default is 1000 ms");
|
||||
System.out.println("-frequency the number of records per second inserted into one table. default is 0, do not control frequency");
|
||||
System.out.println("-order Insert mode--0: In order, 1: Out of order. Default is in order");
|
||||
System.out.println("-rate The proportion of data out of order. effective only if order is 1. min 0, max 100, default is 10");
|
||||
System.out.println("-range The range of data out of order. effective only if order is 1. default is 1000 ms");
|
||||
// query task
|
||||
// System.out.println("-sqlFile The select sql file");
|
||||
// drop task
|
||||
System.out.println("-dropTable Drop data before quit. Default is false");
|
||||
System.out.println("--help Give this help list");
|
||||
}
|
||||
|
||||
/**
|
||||
* parse args from command line
|
||||
*
|
||||
* @param args command line args
|
||||
* @return JdbcTaosdemoConfig
|
||||
*/
|
||||
public JdbcTaosdemoConfig(String[] args) {
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
// instance
|
||||
if ("-host".equals(args[i]) && i < args.length - 1) {
|
||||
host = args[++i];
|
||||
}
|
||||
if ("-port".equals(args[i]) && i < args.length - 1) {
|
||||
port = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-user".equals(args[i]) && i < args.length - 1) {
|
||||
user = args[++i];
|
||||
}
|
||||
if ("-password".equals(args[i]) && i < args.length - 1) {
|
||||
password = args[++i];
|
||||
}
|
||||
// database
|
||||
if ("-database".equals(args[i]) && i < args.length - 1) {
|
||||
database = args[++i];
|
||||
}
|
||||
if ("-keep".equals(args[i]) && i < args.length - 1) {
|
||||
keep = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-days".equals(args[i]) && i < args.length - 1) {
|
||||
days = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-replica".equals(args[i]) && i < args.length - 1) {
|
||||
replica = Integer.parseInt(args[++i]);
|
||||
}
|
||||
// super table
|
||||
if ("-doCreateTable".equals(args[i]) && i < args.length - 1) {
|
||||
doCreateTable = Boolean.parseBoolean(args[++i]);
|
||||
}
|
||||
if ("-superTable".equals(args[i]) && i < args.length - 1) {
|
||||
superTable = args[++i];
|
||||
}
|
||||
if ("-prefixOfFields".equals(args[i]) && i < args.length - 1) {
|
||||
prefixOfFields = args[++i];
|
||||
}
|
||||
if ("-numOfFields".equals(args[i]) && i < args.length - 1) {
|
||||
numOfFields = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-prefixOfTags".equals(args[i]) && i < args.length - 1) {
|
||||
prefixOfTags = args[++i];
|
||||
}
|
||||
if ("-numOfTags".equals(args[i]) && i < args.length - 1) {
|
||||
numOfTags = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-superTableSQL".equals(args[i]) && i < args.length - 1) {
|
||||
superTableSQL = args[++i];
|
||||
}
|
||||
// sub table
|
||||
if ("-prefixOfTable".equals(args[i]) && i < args.length - 1) {
|
||||
prefixOfTable = args[++i];
|
||||
}
|
||||
if ("-numOfTables".equals(args[i]) && i < args.length - 1) {
|
||||
numOfTables = Long.parseLong(args[++i]);
|
||||
}
|
||||
if ("-autoCreateTable".equals(args[i]) && i < args.length - 1) {
|
||||
autoCreateTable = Boolean.parseBoolean(args[++i]);
|
||||
}
|
||||
if ("-numOfThreadsForCreate".equals(args[i]) && i < args.length - 1) {
|
||||
numOfThreadsForCreate = Integer.parseInt(args[++i]);
|
||||
}
|
||||
// insert task
|
||||
if ("-numOfRowsPerTable".equals(args[i]) && i < args.length - 1) {
|
||||
numOfRowsPerTable = Long.parseLong(args[++i]);
|
||||
}
|
||||
if ("-numOfThreadsForInsert".equals(args[i]) && i < args.length - 1) {
|
||||
numOfThreadsForInsert = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-numOfTablesPerSQL".equals(args[i]) && i < args.length - 1) {
|
||||
numOfTablesPerSQL = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-numOfValuesPerSQL".equals(args[i]) && i < args.length - 1) {
|
||||
numOfValuesPerSQL = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-startTime".equals(args[i]) && i < args.length - 1) {
|
||||
startTime = TimeStampUtil.datetimeToLong(args[++i]);
|
||||
}
|
||||
if ("-timeGap".equals(args[i]) && i < args.length - 1) {
|
||||
timeGap = Long.parseLong(args[++i]);
|
||||
}
|
||||
if ("-frequency".equals(args[i]) && i < args.length - 1) {
|
||||
frequency = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-order".equals(args[i]) && i < args.length - 1) {
|
||||
order = Integer.parseInt(args[++i]);
|
||||
}
|
||||
if ("-rate".equals(args[i]) && i < args.length - 1) {
|
||||
rate = Integer.parseInt(args[++i]);
|
||||
if (rate < 0 || rate > 100)
|
||||
throw new IllegalArgumentException("rate must between 0 and 100");
|
||||
}
|
||||
if ("-range".equals(args[i]) && i < args.length - 1) {
|
||||
range = Integer.parseInt(args[++i]);
|
||||
}
|
||||
// select task
|
||||
|
||||
// drop task
|
||||
if ("-dropTable".equals(args[i]) && i < args.length - 1) {
|
||||
dropTable = Boolean.parseBoolean(args[++i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JdbcTaosdemoConfig config = new JdbcTaosdemoConfig(args);
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,7 @@ public class CreateTableTask implements Runnable {
|
|||
Connection connection = ConnectionFactory.build(config);
|
||||
for (int i = startIndex; i < startIndex + tableNumber; i++) {
|
||||
Statement statement = connection.createStatement();
|
||||
String sql = SqlSpeller.createTableSQL(i + 1, config.getDbName(), config.getStbName());
|
||||
String sql = SqlSpeller.createTableSQL(i + 1, config.database, config.superTable);
|
||||
statement.execute(sql);
|
||||
statement.close();
|
||||
logger.info(">>> " + sql);
|
||||
|
|
|
@ -30,10 +30,10 @@ public class InsertTableDatetimeTask implements Runnable {
|
|||
public void run() {
|
||||
try {
|
||||
Connection connection = ConnectionFactory.build(config);
|
||||
int valuesCount = config.getNumberOfRecordsPerRequest();
|
||||
int valuesCount = config.numOfValuesPerSQL;
|
||||
for (long ts = startDatetime; ts < finishedDatetime; ts += valuesCount) {
|
||||
for (int i = startTableIndex; i < startTableIndex + tableNumber; i++) {
|
||||
String sql = SqlSpeller.insertBatchSizeRowsSQL(config.getDbName(), config.getTbPrefix(), i + 1, ts, valuesCount);
|
||||
String sql = SqlSpeller.insertBatchSizeRowsSQL(config.database, config.prefixOfTable, i + 1, ts, valuesCount);
|
||||
Statement statement = connection.createStatement();
|
||||
statement.execute(sql);
|
||||
statement.close();
|
||||
|
|
|
@ -31,7 +31,7 @@ public class InsertTableTask implements Runnable {
|
|||
public void run() {
|
||||
try {
|
||||
Connection connection = ConnectionFactory.build(config);
|
||||
int keep = config.getKeep();
|
||||
int keep = config.keep;
|
||||
Instant end = Instant.now();
|
||||
Instant start = end.minus(Duration.ofDays(keep - 1));
|
||||
long timeGap = ChronoUnit.MILLIS.between(start, end) / (recordsNumberPerTable - 1);
|
||||
|
@ -41,7 +41,7 @@ public class InsertTableTask implements Runnable {
|
|||
long ts = start.toEpochMilli() + (j * timeGap);
|
||||
// insert data into echo table
|
||||
for (int i = startTbIndex; i < startTbIndex + tableNumber; i++) {
|
||||
String sql = SqlSpeller.insertBatchSizeRowsSQL(config.getDbName(), config.getTbPrefix(), i + 1, ts, config.getNumberOfRecordsPerRequest());
|
||||
String sql = SqlSpeller.insertBatchSizeRowsSQL(config.database, config.prefixOfTable, i + 1, ts, config.numOfValuesPerSQL);
|
||||
logger.info(Thread.currentThread().getName() + ">>> " + sql);
|
||||
Statement statement = connection.createStatement();
|
||||
statement.execute(sql);
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Properties;
|
|||
public class ConnectionFactory {
|
||||
|
||||
public static Connection build(JdbcTaosdemoConfig config) throws SQLException {
|
||||
return build(config.getHost(), config.getPort(), config.getDbName(), config.getUser(), config.getPassword());
|
||||
return build(config.host, config.port, config.database, config.user, config.password);
|
||||
}
|
||||
|
||||
public static Connection build(String host, int port, String dbName) throws SQLException {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
taosdemo是为了给TDengine
|
Loading…
Reference in New Issue