Selaa lähdekoodia

change default table & port

apkipa 2 kuukautta sitten
vanhempi
commit
d6484ad54b
1 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 11 1
      src/main/java/db/DBApiEntry.java

+ 11 - 1
src/main/java/db/DBApiEntry.java

@@ -38,7 +38,9 @@ public class DBApiEntry implements AutoCloseable {
 
     private static final double VALUE_INVALID = Double.NaN;
     //    private static final double VALUE_INVALID = -10000;
-    private final static String TABLE_NAME = "tsdb_cpp";
+    private final static String TABLE_NAME = "tsdb_cpp_dist";
+    // ClickHouse HTTP port + 1
+    private final static int DEFAULT_PORT = 8124;
     private final Client client;
     private String host;
     private int port;
@@ -66,6 +68,10 @@ public class DBApiEntry implements AutoCloseable {
         secureCertPath = certPath;
     }
 
+    public DBApiEntry(String addressHost) throws IOException {
+        this(addressHost, DEFAULT_PORT, "default", TABLE_NAME);
+    }
+
     /**
      * 初始化数据驱动构造方法
      *
@@ -114,6 +120,10 @@ public class DBApiEntry implements AutoCloseable {
         client.register(StckPointVal.class, schema);
     }
 
+    public static DBApiEntry initApiEntry(String addressHost) {
+        return initApiEntry(addressHost, DEFAULT_PORT, "default", TABLE_NAME);
+    }
+
     /**
      * 静态方法初始化时序数据源驱动类
      *