diff --git a/src/connector/jdbc/.classpath b/src/connector/jdbc/.classpath deleted file mode 100644 index a5d95095ccaaf9549ee22ff2fbf684bfa43d31c9..0000000000000000000000000000000000000000 --- a/src/connector/jdbc/.classpath +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/connector/jdbc/.project b/src/connector/jdbc/.project deleted file mode 100644 index 656ab58d205bf0e01c151728a75e5ab543facee6..0000000000000000000000000000000000000000 --- a/src/connector/jdbc/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - taos-jdbcdriver - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/PreparedStatementTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/PreparedStatementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3a3d0783a19189c1adcff52b99ef01cbc8d1c5ad --- /dev/null +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/PreparedStatementTest.java @@ -0,0 +1,54 @@ +package com.taosdata.jdbc.cases; + +import com.taosdata.jdbc.lib.TSDBCommon; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class PreparedStatementTest { + private static String host = "localhost"; + + private Connection conn; + + @Before + public void before() { + try { + conn = TSDBCommon.getConn(host); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @After + public void after() { + try { + conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + @Test + public void testCreateSuperTable() { + try { + String sql = "create table if not exists ? (ts timestamp, ? float, ? int) tags(?,?)"; + PreparedStatement pstmt = conn.prepareStatement(sql); + pstmt.setString(1, "td"); + pstmt.setString(2, "temperature"); + pstmt.setString(3, "humidity"); + pstmt.setString(4, "location"); + pstmt.setString(5, "groupId"); + pstmt.executeUpdate(); + + pstmt.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + +}