From 05cf7afc0d6c6fbe39f381d399bd190ed98928e6 Mon Sep 17 00:00:00 2001 From: zyyang Date: Wed, 30 Dec 2020 10:09:31 +0800 Subject: [PATCH] change --- tests/examples/JDBC/taosdemo/pom.xml | 7 +++++-- .../com/taosdata/taosdemo/TaosDemoApplication.java | 4 ++-- .../taosdemo/components/DataSourceFactory.java | 13 +++++++++++-- .../src/main/resources/application.properties | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/examples/JDBC/taosdemo/pom.xml b/tests/examples/JDBC/taosdemo/pom.xml index 9b19ad9fb4..64ffbc06b7 100644 --- a/tests/examples/JDBC/taosdemo/pom.xml +++ b/tests/examples/JDBC/taosdemo/pom.xml @@ -68,6 +68,8 @@ com.taosdata.jdbc taos-jdbcdriver 2.0.15 + system + ${project.basedir}/src/main/resources/lib/taos-jdbcdriver-2.0.15.jar @@ -75,12 +77,12 @@ fastjson 1.2.75 - - + mysql mysql-connector-java 5.1.47 + test @@ -111,6 +113,7 @@ **/*.properties **/*.xml + **/*.jar true diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java index 200b17ec06..b3c609bd0a 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java @@ -25,8 +25,8 @@ public class TaosDemoApplication { // 读配置参数 JdbcTaosdemoConfig config = new JdbcTaosdemoConfig(args); boolean isHelp = Arrays.asList(args).contains("--help"); -// if (isHelp || config.host == null || config.host.isEmpty()) { - if (isHelp) { + if (isHelp || config.host == null || config.host.isEmpty()) { +// if (isHelp) { JdbcTaosdemoConfig.printHelp(); System.exit(0); } diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/components/DataSourceFactory.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/components/DataSourceFactory.java index abd0fcf3a8..c96d6f8bed 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/components/DataSourceFactory.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/components/DataSourceFactory.java @@ -23,10 +23,19 @@ public class DataSourceFactory { properties.load(is); HikariConfig config = new HikariConfig(); - if (properties.containsKey("jdbc.driver")) + + if (properties.containsKey("jdbc.driver")) { +// String driverName = properties.getProperty("jdbc.driver"); +// System.out.println(">>> load driver : " + driverName); +// try { +// Class.forName(driverName); +// } catch (ClassNotFoundException e) { +// e.printStackTrace(); +// } config.setDriverClassName(properties.getProperty("jdbc.driver")); - else + } else { config.setDriverClassName("com.taosdata.jdbc.TSDBDriver"); + } if ("com.taosdata.jdbc.rs.RestfulDriver".equalsIgnoreCase(properties.getProperty("jdbc.driver"))) config.setJdbcUrl("jdbc:TAOS-RS://" + host + ":6041/?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8"); else diff --git a/tests/examples/JDBC/taosdemo/src/main/resources/application.properties b/tests/examples/JDBC/taosdemo/src/main/resources/application.properties index c85824d997..aaa80b9f88 100644 --- a/tests/examples/JDBC/taosdemo/src/main/resources/application.properties +++ b/tests/examples/JDBC/taosdemo/src/main/resources/application.properties @@ -14,7 +14,8 @@ spring.datasource.password=taosdata #spring.datasource.hikari.minimum-idle=1 #spring.datasource.hikari.max-lifetime=0 #logging.level.com.taosdata.taosdemo.dao=error -jdbc.driver=com.taosdata.jdbc.TSDBDriver + +jdbc.driver=com.taosdata.jdbc.rs.RestfulDriver hikari.maximum-pool-size=500 hikari.minimum-idle=100 hikari.max-lifetime=0 \ No newline at end of file -- GitLab