![]() ![]() |
Surkov.Aleksandr |
![]() |
Hi igniters!
I have created a table using JDBC. And I would like to fill it with data using data streamer. But after that I can't execute sql query and get data. After some experimentation, it turned out that SQL select does not return the data put in the table using the cache API. @Test public void differentApproachToCreateTableTest() throws Exception { final String TABLE_NAME = "SqlTable"; try (Ignite ignored = Ignition.start(Config.getServerConfiguration()); IgniteClient client = Ignition.startClient( new ClientConfiguration() .setBinaryConfiguration( new BinaryConfiguration().setCompactFooter(true) ) .setAddresses(Config.SERVER)) ) { // Creating a table using JDBC. try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://localhost:10800/PUBLIC")) { conn.prepareStatement("CREATE TABLE IF NOT EXISTS SqlTable (id int, name varchar, PRIMARY KEY (id)) " + "WITH \"atomicity=transactional,template=partitioned,CACHE_NAME=SqlTable\"") .execute(); } catch (SQLException ex) { ex.printStackTrace(); } final ClientCache<Integer, String> cache = client.cache(TABLE_NAME); cache.put(5, "value of column name field 5"); assertEquals(1, cache.size()); assertEquals("value of column name field 5", cache.get(5)); // No record is visible to SQL. assertEquals(1, cache.query(new SqlFieldsQuery("select count(*) from " + TABLE_NAME )).getAll().get(0).get(0)); } } -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/ |
![]() ![]() |
ilya.kasnacheev |
![]() |
Hello! Have you also tried adding wrap_value=false parameter to your DDL statement? OtherwiseIgnite will assume you have a one-field POJO as a value. Regards, -- Ilya Kasnacheev пн, 28 дек. 2020 г. в 14:16, Surkov.Aleksandr <[hidden email]>: Hi igniters! |
![]() ![]() |
Surkov.Aleksandr |
![]() |
Free forum by Nabble | Edit this page |