This commit is contained in:
zyyang 2021-01-21 17:46:10 +08:00
parent f75390998d
commit bef3b5a846
1 changed files with 15 additions and 9 deletions

View File

@ -11,15 +11,21 @@ public class TSDBDatabaseMetaDataTest {
private Connection connection; private Connection connection;
@Before @Before
public void before() throws ClassNotFoundException, SQLException { public void before() {
Class.forName("com.taosdata.jdbc.TSDBDriver"); try {
Properties properties = new Properties(); Class.forName("com.taosdata.jdbc.TSDBDriver");
properties.setProperty(TSDBDriver.PROPERTY_KEY_HOST, host); Properties properties = new Properties();
properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); properties.setProperty(TSDBDriver.PROPERTY_KEY_HOST, host);
properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
connection = DriverManager.getConnection("jdbc:TAOS://" + host + ":6030/?user=root&password=taosdata", properties); properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
metaData = connection.getMetaData().unwrap(TSDBDatabaseMetaData.class); connection = DriverManager.getConnection("jdbc:TAOS://" + host + ":6030/?user=root&password=taosdata", properties);
metaData = connection.getMetaData().unwrap(TSDBDatabaseMetaData.class);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
} }
@After @After