未验证 提交 39b6ad9b 编写于 作者: H huili 提交者: GitHub

Merge pull request #4846 from taosdata/hotfix/TD-2286

Hotfix/td 2286
package com.taosdata.jdbc.cases;
import org.junit.Assert;
import org.junit.Test;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectWrongDatabaseTest {
@Test
public void connect() {
try {
Class.forName("com.taosdata.jdbc.TSDBDriver");
DriverManager.getConnection("jdbc:TAOS://localhost:6030/wrong_db?user=root&password=taosdata");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
System.out.println(e.getMessage());
Assert.assertEquals("TDengine Error: Invalid database name", e.getMessage());
}
}
}
......@@ -48,4 +48,12 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId>
<version>2.0.15</version>
</dependency>
</dependencies>
</project>
......@@ -5,7 +5,7 @@ import java.util.Properties;
public class JDBCDemo {
private static String host;
private static String driverType;
private static String driverType = "jni";
private static final String dbName = "test";
private static final String tbName = "weather";
private Connection connection;
......@@ -21,7 +21,7 @@ public class JDBCDemo {
}
}
if (host == null || driverType == null) {
if (host == null) {
printHelp();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册