Skip to content

Commit eaabc92

Browse files
committed
Java: MultiDataSource 新增 TimescaleDB-高性能实时分析时序数据库 的配置示例
1 parent 1a88a7a commit eaabc92

File tree

1 file changed

+43
-34
lines changed
  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo

1 file changed

+43
-34
lines changed

Diff for: APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo/DemoSQLConfig.java

+43-34
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ public String getDBVersion() {
164164
if (isDb2()) {
165165
return "11.5"; //TODO 改成你自己的
166166
}
167-
// if (isSQLite()) {
168-
// return "3.39.3"; //TODO 改成你自己的
169-
// }
167+
// if (isSQLite()) {
168+
// return "3.39.3"; //TODO 改成你自己的
169+
// }
170170
if (isDameng()) {
171171
return "8.1.2.141"; //TODO 改成你自己的
172172
}
@@ -212,17 +212,17 @@ public String getDBUri() {
212212

213213
if (isMySQL()) {
214214
// 这个是 MySQL 8.0 及以上,要加 userSSL=false
215-
// return "jdbc:mysql://47.122.25.116:3306?userSSL=false&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8";
215+
// return "jdbc:mysql://47.122.25.116:3306?userSSL=false&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8";
216216
// 以下是 MySQL 5.7 及以下
217217
return "jdbc:mysql://localhost:3306?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8"; //TODO 改成你自己的,TiDB 可以当成 MySQL 使用,默认端口为 4000
218218
}
219219
if (isPostgreSQL()) { // PG JDBC 必须在 URI 传 catalog
220220
return "jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified"; //TODO 改成你自己的
221221
}
222-
//if (isCockroachDB()) { // PG JDBC 必须在 URI 传 catalog
223-
// return "jdbc:postgresql://localhost:26257/movr?sslmode=require"; //TODO 改成你自己的 brew install cockroachdb/tap/cockroach && cockroach demo
224-
// //return "jdbc:postgresql://localhost:26258/postgres?sslmode=disable"; //TODO 改成你自己的 brew install cockroachdb/tap/cockroach # && start 3 nodes and init cluster
225-
//}
222+
// if (isCockroachDB()) { // PG JDBC 必须在 URI 传 catalog
223+
// return "jdbc:postgresql://localhost:26257/movr?sslmode=require"; //TODO 改成你自己的 brew install cockroachdb/tap/cockroach && cockroach demo
224+
// // return "jdbc:postgresql://localhost:26258/postgres?sslmode=disable"; //TODO 改成你自己的 brew install cockroachdb/tap/cockroach # && start 3 nodes and init cluster
225+
// }
226226
if (isSQLServer()) {
227227
return "jdbc:jtds:sqlserver://localhost:1433/pubs;instance=SQLEXPRESS"; //TODO 改成你自己的
228228
}
@@ -232,25 +232,28 @@ public String getDBUri() {
232232
if (isDb2()) {
233233
return "jdbc:db2://localhost:50000/BLUDB"; //TODO 改成你自己的
234234
}
235-
//if (isSQLite()) {
236-
// return "jdbc:sqlite:sample.db"; //TODO 改成你自己的
237-
//}
235+
// if (isSQLite()) {
236+
// return "jdbc:sqlite:sample.db"; //TODO 改成你自己的
237+
// }
238238
if (isDameng()) {
239239
return "jdbc:dm://localhost:5236"; //TODO 改成你自己的
240240
}
241241
if (isTDengine()) {
242242
// return "jdbc:TAOS://localhost:6030"; //TODO 改成你自己的
243243
return "jdbc:TAOS-RS://localhost:6041"; //TODO 改成你自己的
244244
}
245+
// if (isTimescaleDB()) { // PG JDBC 必须在 URI 传 catalog
246+
// return "jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified"; //TODO 改成你自己的
247+
// }
245248
if (isInfluxDB()) {
246249
return "http://203.189.6.3:8086"; //TODO 改成你自己的
247250
}
248251
if (isMilvus()) {
249252
return "http://localhost:19530"; //TODO 改成你自己的
250253
}
251-
//if (isManticore()) {
252-
// return "jdbc:mysql://localhost:9306?characterEncoding=utf8&maxAllowedPacket=512000"; //TODO 改成你自己的
253-
//}
254+
// if (isManticore()) {
255+
// return "jdbc:mysql://localhost:9306?characterEncoding=utf8&maxAllowedPacket=512000"; //TODO 改成你自己的
256+
// }
254257
// if (isIoTDB()) {
255258
// return "jdbc:iotdb://localhost:6667"; // ?charset=GB18030 加参数会报错 URI 格式错误 //TODO 改成你自己的
256259
// }
@@ -293,10 +296,10 @@ public String getDBAccount() {
293296
if (isPostgreSQL()) {
294297
return "postgres"; //TODO 改成你自己的
295298
}
296-
//if (isCockroachDB()) { // PG JDBC 必须在 URI 传 catalog
297-
// return "demo"; //TODO 改成你自己的
298-
// //return "postgres"; //TODO 改成你自己的
299-
//}
299+
// if (isCockroachDB()) { // PG JDBC 必须在 URI 传 catalog
300+
// return "demo"; //TODO 改成你自己的
301+
// //return "postgres"; //TODO 改成你自己的
302+
// }
300303
if (isSQLServer()) {
301304
return "sa"; //TODO 改成你自己的
302305
}
@@ -306,24 +309,27 @@ public String getDBAccount() {
306309
if (isDb2()) {
307310
return "db2admin"; //TODO 改成你自己的
308311
}
309-
//if (isSQLite()) {
310-
// return "root"; //TODO 改成你自己的
311-
//}
312+
// if (isSQLite()) {
313+
// return "root"; //TODO 改成你自己的
314+
// }
312315
if (isDameng()) {
313316
return "SYSDBA";
314317
}
315318
if (isTDengine()) {
316319
return "root"; //TODO 改成你自己的
317320
}
321+
// if (isTimescaleDB()) {
322+
// return "postgres"; //TODO 改成你自己的
323+
// }
318324
if (isInfluxDB()) {
319325
return "iotos";
320326
}
321327
if (isMilvus()) {
322328
return "root";
323329
}
324-
//if (isManticore()) {
325-
// return null; // "root";
326-
//}
330+
// if (isManticore()) {
331+
// return null; // "root";
332+
// }
327333
// if (isIoTDB()) {
328334
// return "root";
329335
// }
@@ -365,10 +371,10 @@ public String getDBPassword() {
365371
if (isPostgreSQL()) {
366372
return null; //TODO 改成你自己的
367373
}
368-
//if (isCockroachDB()) { // PG JDBC 必须在 URI 传 catalog
369-
// return "demo39865"; //TODO 改成你自己的
370-
// //return null; //TODO 改成你自己的
371-
//}
374+
// if (isCockroachDB()) { // PG JDBC 必须在 URI 传 catalog
375+
// return "demo39865"; //TODO 改成你自己的
376+
// // return null; //TODO 改成你自己的
377+
// }
372378
if (isSQLServer()) {
373379
return "apijson@123"; //TODO 改成你自己的
374380
}
@@ -378,24 +384,27 @@ public String getDBPassword() {
378384
if (isDb2()) {
379385
return "123"; //TODO 改成你自己的
380386
}
381-
// if (isSQLite()) {
382-
// return "apijson"; //TODO 改成你自己的
383-
// }
387+
// if (isSQLite()) {
388+
// return "apijson"; //TODO 改成你自己的
389+
// }
384390
if (isDameng()) {
385391
return "SYSDBA";
386392
}
387393
if (isTDengine()) {
388394
return "taosdata"; //TODO 改成你自己的
389395
}
396+
// if (isTimescaleDB()) {
397+
// return "password"; //TODO 改成你自己的
398+
// }
390399
if (isInfluxDB()) {
391400
return "apijson@123"; //TODO 改成你自己的
392401
}
393402
if (isMilvus()) {
394403
return "apijson"; //TODO 改成你自己的
395404
}
396-
//if (isManticore()) {
397-
// return null;
398-
//}
405+
// if (isManticore()) {
406+
// return null;
407+
// }
399408
// if (isIoTDB()) {
400409
// return "root";
401410
// }

0 commit comments

Comments
 (0)