A bug for this is filed: https://issues.apache.org/jira/browse/IGNITE-10414
Stan From: Qingping Sent: 27 ноября 2018 г. 4:26 To: user@ignite.apache.org Subject: some cases (IF NOT EXISTS) in the CREATE TABLE statement does notwork ====Question=========== When testing Ignite 2.6.0 (2018-07-16), it was found that in some cases (IF NOT EXISTS) in the CREATE TABLE statement does not work. ====[Wrong case]==== After the first run is successful, the code will prompt "Table already exists: CITY" in the next iteration: java.sql.SQLException: Table already exists: CITY at org.apache.ignite.internal.jdbc.thin.JdbcThinConnection.sendRequest(JdbcThinConnection.java:751) at org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute0(JdbcThinStatement.java:210) at org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.executeUpdate(JdbcThinStatement.java:338) at ignite.examp.IgniteSQL_Error.main(IgniteSQL_Error.java:47) --- public class IgniteSQL_Error { public static void main(String[] aArgvs) { try { Ignition.setClientMode(true); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName("IgniteSQL_Error"); TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); ipFinder.setAddresses(Arrays.asList("192.168.0.219", "192.168.0.220", "192.168.0.221")); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(ipFinder); cfg.setDiscoverySpi(spi); try (Ignite ignite = Ignition.start(cfg)) { Class.forName("org.apache.ignite.IgniteJdbcThinDriver"); final String jdbcConnUrl = "jdbc:ignite:thin://127.0.0.1/"; try (Connection conn = DriverManager.getConnection(jdbcConnUrl)) { try (Statement stmt = conn.createStatement()) { stmt.executeUpdate("CREATE TABLE IF NOT EXISTS City(id LONG PRIMARY KEY, name VARCHAR)"); System.out.println("[Fine]CREATE TABLE IF NOT EXISTS City"); } } } } catch (Exception ex) { ex.printStackTrace(); } } } ====[Correct case]==== The following code can always run successfully (in the JDBC connection URL, directly specify one of the server nodes of the Ignite cluster) --- public class IgniteSQL_Ok { public static void main(String[] aArgvs) { try { Class.forName("org.apache.ignite.IgniteJdbcThinDriver"); final String jdbcConnUrl = "jdbc:ignite:thin://192.168.0.219/"; try (Connection conn = DriverManager.getConnection(jdbcConnUrl)) { try (Statement stmt = conn.createStatement()) { stmt.executeUpdate("CREATE TABLE IF NOT EXISTS City(id LONG PRIMARY KEY, name VARCHAR)"); System.out.println("[Fine]CREATE TABLE IF NOT EXISTS City"); } } } catch (Exception ex) { ex.printStackTrace(); } } } -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/