Hi Dmitriy, Thanks for your reply. I was able to load data into cache after adding the QueryEntity in configuration. And I actually needed to restart the server database to pick up the new configuration. Is there a way that I can create new cache without restarting the server?
Thank so much Ivan On Thu, Mar 16, 2017 at 1:24 PM, Dmitriy Setrakyan <[email protected]> wrote: > DDL commands are not supported in Ignite yet. However, in Ignite the table > will be created automatically if you define a class with @SqlQueryField > annotations or define a QueryEntity in configuration, as described here: > > https://apacheignite.readme.io/docs/indexes > > Starting with Ignite 2.0, planned in April, Ignite will support CREATE/DROP > INDEX command. Further it is planned that towards June/July Ignite will have > full DDL support, including CREATE/ALTER/DROP TABLE commands. > > D. > > On Thu, Mar 16, 2017 at 11:46 AM, Ivan Zeng <[email protected]> wrote: >> >> Hi, >> >> I am new to Ignite. Could you tell me the right way to create a >> cache, load data into cache, and then query the cache via JDBC? >> >> I wrote the following code to create a table via JDBC. >> >> >> Class.forName("org.apache.ignite.IgniteJdbcDriver"); >> con = DriverManager.getConnection (connectionURL) >> String create_sql = "CREATE TABLE Person " + >> "(_key INTEGER PRIMARY KEY, " + >> " name VARCHAR(255), " + >> " age INTEGER);"; >> Statement cstmt = con.createStatement(); >> cstmt.executeQuery(create_sql); >> >> >> But i got this error. >> >> java.sql.SQLException: Failed to query Ignite. >> at >> org.apache.ignite.internal.jdbc2.JdbcStatement.executeQuery(JdbcStatement.java:131) >> at IgniteJDBC.main(IgniteJDBC.java:26) >> Caused by: javax.cache.CacheException: Unsupported SQL statement: >> CREATE TABLE Person (_key INTEGER PRIMARY KEY, name VARCHAR(255), >> age INTEGER) >> >> Thanks so much >> Ivan > >
