I'm trying to create a USER (in this case using a H2 database) using JDOQL in DataNucleus
PersistenceManager pm=pmf.getPersistenceManager();
Query query = pm.newQuery("javax.jdo.query.SQL", "CREATE USER GUEST PASSWORD 'abc'");
query.execute();
result: org.h2.jdbc.JdbcSQLException: Method is only allowed for a query. Use execute or executeUpdate instead of executeQuery;
How can i execute this?
Thanks.
Did you try to set the pmf property? datanucleus.query.sql.allowAll=true
Another way you can try is something like that:
JDOConnection con = pm.getDataStoreConnection();
Connection nativeCon = (Connection) con.getNativeConnection();
...
Statement stmt = nativeCon.createStatement();
stmt.executeUpdate("CREATE USER GUEST PASSWORD 'abc'");
...