diff --git a/tests/examples/JDBC/calciteDemo/pom.xml b/tests/examples/JDBC/calciteDemo/pom.xml deleted file mode 100644 index a7d47837d9ba407f3959a00d522a9cd26b5622db..0000000000000000000000000000000000000000 --- a/tests/examples/JDBC/calciteDemo/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - com.taosdata.example.calcite - calciteDemo - 1.0-SNAPSHOT - - - - - org.slf4j - slf4j-simple - 1.7.25 - compile - - - - org.apache.calcite - calcite-core - 1.23.0 - - - org.apache.commons - commons-dbcp2 - 2.7.0 - - - org.apache.calcite.avatica - avatica-core - 1.17.0 - - - - - mysql - mysql-connector-java - 5.1.47 - - - - - com.taosdata.jdbc - taos-jdbcdriver - 2.0.8 - - - - - - \ No newline at end of file diff --git a/tests/examples/JDBC/calciteDemo/src/main/java/com/taosdata/example/calcite/CalciteDemo.java b/tests/examples/JDBC/calciteDemo/src/main/java/com/taosdata/example/calcite/CalciteDemo.java deleted file mode 100644 index 7e97956b7879c26056b9b0e27cce4786284ff96c..0000000000000000000000000000000000000000 --- a/tests/examples/JDBC/calciteDemo/src/main/java/com/taosdata/example/calcite/CalciteDemo.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.taosdata.example.calcite; - -import org.apache.calcite.adapter.jdbc.JdbcSchema; -import org.apache.calcite.jdbc.CalciteConnection; -import org.apache.calcite.schema.Schema; -import org.apache.calcite.schema.SchemaPlus; -import org.apache.calcite.sql.parser.SqlParseException; -import org.apache.commons.dbcp2.BasicDataSource; - -import java.sql.*; -import java.util.Properties; - -public class CalciteDemo { - - private static String url_taos = "jdbc:TAOS://192.168.236.135:6030/test"; - private static String url_mysql = "jdbc:mysql://master:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8"; - - public static void main(String[] args) throws SqlParseException, ClassNotFoundException, SQLException { - Class.forName("org.apache.calcite.jdbc.Driver"); - Properties info = new Properties(); - info.setProperty("caseSensitive", "false"); - - Connection connection = DriverManager.getConnection("jdbc:calcite:", info); - CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); - - SchemaPlus rootSchema = calciteConnection.getRootSchema(); - - //这里hdb是在tdengine中创建的数据库名 - Schema schema = mysqlTest(rootSchema); -// Schema schema = tdengineTest(rootSchema); - - //创建新的schema自动映射到原来的hdb数据库 - rootSchema.add("test", schema); - - Statement stmt = calciteConnection.createStatement(); - //查询schema test中的表,表名是tdengine中的表 - ResultSet rs = stmt.executeQuery("select * from test.t"); - ResultSetMetaData metaData = rs.getMetaData(); - while (rs.next()) { - for (int i = 1; i <= metaData.getColumnCount(); i++) { - System.out.println(metaData.getColumnLabel(i) + " : " + rs.getString(i)); - } - } - } - - - private static Schema tdengineTest(SchemaPlus rootSchema) throws ClassNotFoundException { - Class.forName("com.taosdata.jdbc.TSDBDriver"); - BasicDataSource dataSource = new BasicDataSource(); - dataSource.setUrl(url_taos); - dataSource.setUsername("root"); - dataSource.setPassword("taosdata"); - - return JdbcSchema.create(rootSchema, "test", dataSource, "hdb", null); - } - - private static Schema mysqlTest(SchemaPlus rootSchema) throws ClassNotFoundException { - Class.forName("com.mysql.jdbc.Driver"); - BasicDataSource dataSource = new BasicDataSource(); - dataSource.setUrl(url_mysql); - dataSource.setUsername("root"); - dataSource.setPassword("123456"); - - //Schema schema = JdbcSchema.create(rootSchema, "test", dataSource, "hdb", null); - return JdbcSchema.create(rootSchema, "test", dataSource, "test", null); - } -} diff --git a/tests/examples/JDBC/calciteDemo/src/main/resources/log4j.properties b/tests/examples/JDBC/calciteDemo/src/main/resources/log4j.properties deleted file mode 100644 index 1a77ec520cd3e727ac51acb4b8f647b7cf188d97..0000000000000000000000000000000000000000 --- a/tests/examples/JDBC/calciteDemo/src/main/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootLogger=info,stdout - -#console -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern= [%d{yyyy-MM-dd HH:mm:ss a}]:%p %l%m%n \ No newline at end of file