This commit is contained in:
zyyang 2021-01-27 17:51:38 +08:00
parent b346f51889
commit ee85996beb
1 changed files with 2 additions and 3 deletions

View File

@ -34,7 +34,6 @@ public class SubscribeDemo {
return;
}
/*********************************************************************************************/
try {
Class.forName("com.taosdata.jdbc.TSDBDriver");
Properties properties = new Properties();
@ -43,7 +42,7 @@ public class SubscribeDemo {
properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
final String url = "jdbc:TAOS://" + host + ":6030/" + database + "?user=root&password=taosdata";
// get TSDBConnection
TSDBConnection connection = DriverManager.getConnection(url, properties).unwrap(TSDBConnection.class);
TSDBConnection connection = (TSDBConnection) DriverManager.getConnection(url, properties);
// create TSDBSubscribe
TSDBSubscribe sub = connection.subscribe(topic, sql, false);
@ -66,4 +65,4 @@ public class SubscribeDemo {
e.printStackTrace();
}
}
}
}