You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by siva <si...@bizruntime.com> on 2020/01/10 17:24:56 UTC

Failed to execute DML statement Ignite JDBC

Hi,
I am using Ignite v2.7.6 ,JDBC PrepareStatement to execute insert query on
IgniteThin Driver.

Cache,table and index created through QueryEntities.
like below
              

here is the code i am executing


here is an Exception:









--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failed to execute DML statement Ignite JDBC

Posted by siva <si...@bizruntime.com>.
Hi,
Thanks for reply.I will look into this.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failed to execute DML statement Ignite JDBC

Posted by Pavel Tupitsyn <pt...@apache.org>.
[Key] attribute is not recognized by Ignite, you should set
QueryEntity.KeyFieldName = "EntityId".

This is a good catch, by the way - I've filed a ticket:
https://issues.apache.org/jira/browse/IGNITE-12532

On Mon, Jan 13, 2020 at 5:32 PM siva <si...@bizruntime.com> wrote:

> *Step-1:Model class*
> ---------------------------------
> namespace Models.Ignite
> {
>    public class ENTITIESTABLEINFO : ICustomCacheStore
>     {
>         [QuerySqlField]
>         [Key]
>         public String EntityId { get; set; }
>         [QuerySqlField]
>         public String EntityType { get; set; }
>         [QuerySqlField]
>         public String EntityInfoJson { get; set; }
>         [QuerySqlField]
>         public String TenantName { get; set; }
>         [QuerySqlField]
>         public String TenantId { get; set; }
>         [QuerySqlField]
>         public String Fabric { get; set; }
>         [QuerySqlField]
>         public String EntityName { get; set; }
>         [QuerySqlField]
>         public double SequenceNumber { get; set; }
>     }
> }
>
>
>
>
> *Step-2:Create Cache,table and indexes:*
> --------------------------------------
> using Models.Ignite.ENTITIESTABLEINFO;
>
> //create indexes
> struct QueryEntityIndexFields
> {
>         public string[] PrimaryKeys;
>         public Type ModelType;
>         //public string QueryIndexType;
> }
> private static readonly string[] indexFieldOfEntityId = new[] { "EntityId"
> };
> private static readonly QueryEntityIndexFields[] prodModels = new[] {
>             //fdc models
>             new QueryEntityIndexFields(){PrimaryKeys=indexFieldOfEntityId,
> ModelType=  typeof(ENTITIESTABLEINFO)}
> }
>
> private async Task<List&lt;QueryEntity>>
> GetQueryEntitiesBasedOnCapability(QueryEntityIndexFields[]
> queryEntityIndexFieldsList)
>         {
>             List<QueryEntity> queryList = new List<QueryEntity>();
>             foreach (var modelObject in queryEntityIndexFieldsList)
>             {
>                 var query = new QueryEntity(typeof(string),
> modelObject.ModelType)
>                 {
>                     Indexes = new
> List<QueryIndex>(modelObject.PrimaryKeys.Count() + 1)
>                         {
>                             new QueryIndex(true,0,modelObject.PrimaryKeys)
>                         }
>                 };
>                 queryList.Add(query);
>             }
>             return queryList;
>         }
> var queryList = await
> _queryEntities.CreateQueryEntitiesListAsync(capabilityName);
>
>
> //Cache configuration
> cacheCfg = new CacheConfiguration(cacheName)
> {
>         Name = cacheName,
>         CacheStoreFactory = new TenantCacheStoreFactory(_logger,
> connectionString),
>         KeepBinaryInStore = false,  // Cache store works with deserialized
> data.
>         ReadThrough = true,
>         WriteThrough = true,
>         WriteBehindEnabled = true,
>     QueryEntities = queryList,
>         WriteBehindFlushThreadCount = 2,
>         CacheMode = CacheMode.Partitioned,
>         Backups = 0,
>         DataRegionName = "IgniteDataRegion",
>         EvictionPolicy = new LruEvictionPolicy
>         {
>                 MaxSize = 100000
>         }
> };
>
> Ignite.AddCacheConfiguration(cacheCfg);
> // Create cache with given name, if it does not exist.
> ICache<KeyModel, ICustomCacheStore> cache =
> Ignite.GetOrCreateCache<KeyModel, ICustomCacheStore>(cacheCfg);
>
> where cacheName is "C091E548-B45A-49B4-B8EC-2CB5E27C7AF6";
> *
> Step-3:Insert Statement:*
> -------------------------
> INSERT INTO
>
> "C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".ENTITIESTABLEINFO(EntityId,EntityInfoJson,EntityName,EntityType,Fabric,SequenceNumber,TenantId,TenantName)
> VALUES ('0-pulsar', '{}', 'Testing Topic0 Name', 'testpulsarType',
> 'pulsarFabric', 0.0, 'pulsar-123-tenantid', 'pulsar-tenantName');
>
> onces insert statement execute get before mention exception.
> Anything else required,please let me know.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Failed to execute DML statement Ignite JDBC

Posted by siva <si...@bizruntime.com>.
*Step-1:Model class*
---------------------------------
namespace Models.Ignite
{
   public class ENTITIESTABLEINFO : ICustomCacheStore
    {
        [QuerySqlField]
        [Key]
        public String EntityId { get; set; }
        [QuerySqlField]
        public String EntityType { get; set; }
        [QuerySqlField]
        public String EntityInfoJson { get; set; }
        [QuerySqlField]
        public String TenantName { get; set; }
        [QuerySqlField]
        public String TenantId { get; set; }
        [QuerySqlField]
        public String Fabric { get; set; }
        [QuerySqlField]
        public String EntityName { get; set; }
        [QuerySqlField]
        public double SequenceNumber { get; set; }
    }
}




*Step-2:Create Cache,table and indexes:*
--------------------------------------
using Models.Ignite.ENTITIESTABLEINFO;

//create indexes
struct QueryEntityIndexFields
{
	public string[] PrimaryKeys;
	public Type ModelType;
	//public string QueryIndexType;
}
private static readonly string[] indexFieldOfEntityId = new[] { "EntityId"
};
private static readonly QueryEntityIndexFields[] prodModels = new[] {
            //fdc models
            new QueryEntityIndexFields(){PrimaryKeys=indexFieldOfEntityId,
ModelType=  typeof(ENTITIESTABLEINFO)}
}

private async Task<List&lt;QueryEntity>>
GetQueryEntitiesBasedOnCapability(QueryEntityIndexFields[]
queryEntityIndexFieldsList)
        {
            List<QueryEntity> queryList = new List<QueryEntity>();
            foreach (var modelObject in queryEntityIndexFieldsList)
            {
                var query = new QueryEntity(typeof(string),
modelObject.ModelType)
                {
                    Indexes = new
List<QueryIndex>(modelObject.PrimaryKeys.Count() + 1)
                        {
                            new QueryIndex(true,0,modelObject.PrimaryKeys)
                        }
                };
                queryList.Add(query);
            }
            return queryList;
        }
var queryList = await
_queryEntities.CreateQueryEntitiesListAsync(capabilityName);


//Cache configuration
cacheCfg = new CacheConfiguration(cacheName)
{
	Name = cacheName,
	CacheStoreFactory = new TenantCacheStoreFactory(_logger, connectionString),
	KeepBinaryInStore = false,  // Cache store works with deserialized data.
	ReadThrough = true,
	WriteThrough = true,
	WriteBehindEnabled = true,
    QueryEntities = queryList,
	WriteBehindFlushThreadCount = 2,
	CacheMode = CacheMode.Partitioned,
	Backups = 0,
	DataRegionName = "IgniteDataRegion",
	EvictionPolicy = new LruEvictionPolicy
	{
		MaxSize = 100000
	}
};

Ignite.AddCacheConfiguration(cacheCfg);
// Create cache with given name, if it does not exist.
ICache<KeyModel, ICustomCacheStore> cache =
Ignite.GetOrCreateCache<KeyModel, ICustomCacheStore>(cacheCfg);

where cacheName is "C091E548-B45A-49B4-B8EC-2CB5E27C7AF6";
*
Step-3:Insert Statement:*
-------------------------
INSERT INTO
"C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".ENTITIESTABLEINFO(EntityId,EntityInfoJson,EntityName,EntityType,Fabric,SequenceNumber,TenantId,TenantName)
VALUES ('0-pulsar', '{}', 'Testing Topic0 Name', 'testpulsarType',
'pulsarFabric', 0.0, 'pulsar-123-tenantid', 'pulsar-tenantName');

onces insert statement execute get before mention exception.
Anything else required,please let me know.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failed to execute DML statement Ignite JDBC

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Pretty descriptive:
*Caused by: org.apache.ignite.IgniteChecke**dException: Key is missing from
query*

How is your cache key declared? Which fields are supposed to go in it?

Regards,
-- 
Ilya Kasnacheev


пн, 13 янв. 2020 г. в 13:05, siva <si...@bizruntime.com>:

> Hi,
> Thank you for suggestion.
> Please find the Server log exception:
> ----------------------------------------
> org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to
> execute DML statement [stmt=INSERT INTO
>
> "C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".ENTITIESTABLEINFO(EntityId,EntityInfoJson,EntityName,EntityType,Fabric,SequenceNumber,TenantId,TenantName)
> VALUES ('0-pulsar', '{}', 'Testing Topic0 Name', 'testpulsarType',
> 'pulsarFabric', 0.0, 'pulsar-123-tenantid', 'pulsar-tenantName'),
> params=null]
>         at
>
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunPrepared(IgniteH2Indexing.java:2284)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:2209)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2128)
> ~[ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2123)
> ~[ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
> ~[ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2693)
> ~[ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2137)
> ~[ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.executeQuery(JdbcRequestHandler.java:511)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.doHandle(JdbcRequestHandler.java:245)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.handle(JdbcRequestHandler.java:208)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:162)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:45)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70)
> [ignite-core-2.7.5.jar:2.7.5]
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [?:1.8.0_144]
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [?:1.8.0_144]
>         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
> Caused by: org.apache.ignite.IgniteCheckedException: Key is missing from
> query
>         at
>
> org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder.createSupplier(UpdatePlanBuilder.java:604)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder.planForInsert(UpdatePlanBuilder.java:270)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder.planForStatement(UpdatePlanBuilder.java:135)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor.getPlanForStatement(DmlStatementsProcessor.java:741)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor.updateSqlFields(DmlStatementsProcessor.java:175)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor.updateSqlFieldsDistributed(DmlStatementsProcessor.java:358)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         at
>
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunPrepared(IgniteH2Indexing.java:2263)
> ~[ignite-indexing-2.7.5.jar:2.7.5]
>         ... 19 more
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Failed to execute DML statement Ignite JDBC

Posted by siva <si...@bizruntime.com>.
Hi,
Thank you for suggestion.
Please find the Server log exception:
----------------------------------------
org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to
execute DML statement [stmt=INSERT INTO 
"C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".ENTITIESTABLEINFO(EntityId,EntityInfoJson,EntityName,EntityType,Fabric,SequenceNumber,TenantId,TenantName)
VALUES ('0-pulsar', '{}', 'Testing Topic0 Name', 'testpulsarType',
'pulsarFabric', 0.0, 'pulsar-123-tenantid', 'pulsar-tenantName'),
params=null]
        at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunPrepared(IgniteH2Indexing.java:2284)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:2209)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2128)
~[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2123)
~[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
~[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2693)
~[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2137)
~[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.executeQuery(JdbcRequestHandler.java:511)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.doHandle(JdbcRequestHandler.java:245)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.handle(JdbcRequestHandler.java:208)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:162)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:45)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
[ignite-core-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70)
[ignite-core-2.7.5.jar:2.7.5]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[?:1.8.0_144]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[?:1.8.0_144]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: org.apache.ignite.IgniteCheckedException: Key is missing from
query
        at
org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder.createSupplier(UpdatePlanBuilder.java:604)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder.planForInsert(UpdatePlanBuilder.java:270)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.h2.dml.UpdatePlanBuilder.planForStatement(UpdatePlanBuilder.java:135)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor.getPlanForStatement(DmlStatementsProcessor.java:741)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor.updateSqlFields(DmlStatementsProcessor.java:175)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor.updateSqlFieldsDistributed(DmlStatementsProcessor.java:358)
~[ignite-indexing-2.7.5.jar:2.7.5]
        at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.doRunPrepared(IgniteH2Indexing.java:2263)
~[ignite-indexing-2.7.5.jar:2.7.5]
        ... 19 more



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failed to execute DML statement Ignite JDBC

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

This is a mailing list, so messages are not editable.

Unfortunately I can't see any exception in your last message. Please paste
it as text.

Regards,
-- 
Ilya Kasnacheev


пн, 13 янв. 2020 г. в 12:57, siva <si...@bizruntime.com>:

> Hi,
> sorry,there was a typo mistake or post message issue.as i edited after
> post
> post message.
>
> this is log as exception getting on server:
> ------------------------------------------
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Failed to execute DML statement Ignite JDBC

Posted by siva <si...@bizruntime.com>.
Hi,
sorry,there was a typo mistake or post message issue.as i edited after post
post message.

this is log as exception getting on server:
------------------------------------------





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failed to execute DML statement Ignite JDBC

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

You should search your server nodes' logs for an exact error message
corresponding to this client error. Can you find it, paste to your message?

Regards,
-- 
Ilya Kasnacheev


сб, 11 янв. 2020 г. в 08:41, siva <si...@bizruntime.com>:

> Cache,table and index created through QueryEntities.
> like below
>
> cacheCfg = new CacheConfiguration
> {
>         ...
>         QueryEntities = queryList,
>         ...
>
> };
> here is the code i am executing
> public static void main( String[] args ) throws ClassNotFoundException,
> SQLException
>     {
>                 System.out.println( "main start!" );
>
>
>                 // Register JDBC driver.
>                 Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
>
>                 // Open the JDBC connection.
>                 Connection conn =
>
> DriverManager.getConnection("jdbc:ignite:thin://localhost/9E7B08B5-3BFD-4026-B322-C4A34FFFAFD7");//cacheName
>
>                 /*
>                         //Select query...
>                         Statement stmt = conn.createStatement();
>                         String query = "select * from
> \"9E7B08B5-3BFD-4026-B322-C4A34FFFAFD7\".ENTITIESTABLEINFO";
>                         boolean status = stmt.execute(query);
>                         if(status){
>                                 ResultSet rs = stmt.getResultSet();
>                                 while(rs.next()){
>
> System.out.println(rs.getString(1));
>                                 }
>                                 rs.close();
>                         }*/
>
>                 String sqlQuery = "INSERT INTO ENTITIESTABLEINFO
>
> (ENTITYID,ENTITYINFOJSON,ENTITYNAME,ENTITYTYPE,FABRIC,SEQUENCENUMBER,TENANTID,TENANTNAME)"
>                     + " VALUES(?, ?, ?, ?,?,?,?,?)";
>                     PreparedStatement prepStmt =
> conn.prepareStatement(sqlQuery);
>                     prepStmt.setString(1,
> "pulsarTesting-1-1-1-1-EntityId");
>                     prepStmt.setString(2, "{}");
>                     prepStmt.setString(3, "PulsarEntityName");
>                     prepStmt.setString(4, "PulsarEntityType");
>                     prepStmt.setString(5, "PulsarFabric");
>                     prepStmt.setDouble(6, 123.0);
>                     prepStmt.setString(7, "pulsar-TenantId");
>                     prepStmt.setString(8, "PulsarTenant");
>
>                     prepStmt.execute();
>
>                 System.out.println("Statement executed...");
>     }
>
> here is an Exception:
>
> Exception in thread "main" java.sql.SQLException: Failed to execute DML
> statement [stmt=INSERT INTO ENTITIESTABLEINFO
>
> (ENTITYID,ENTITYINFOJSON,ENTITYNAME,ENTITYTYPE,FABRIC,SEQUENCENUMBER,TENANTID,TENANTNAME)
> VALUES(?, ?, ?, ?,?,?,?,?), params=[pulsarTesting-1-1-1-1-EntityId, aa,
> PulsarEntityName, PulsarEntityType, PulsarFabric, 123.0, pulsar-TenantId,
> PulsarTenant]]
>         at
>
> org.apache.ignite.internal.jdbc.thin.JdbcThinConnection.sendRequest(JdbcThinConnection.java:750)
>         at
>
> org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute0(JdbcThinStatement.java:212)
>         at
>
> org.apache.ignite.internal.jdbc.thin.JdbcThinPreparedStatement.executeWithArguments(JdbcThinPreparedStatement.java:252)
>         at
>
> org.apache.ignite.internal.jdbc.thin.JdbcThinPreparedStatement.execute(JdbcThinPreparedStatement.java:240)
>         at
> org.apache.pulsar.io.jdbc.javaclienttest.project.App.main(App.java:133)
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Failed to execute DML statement Ignite JDBC

Posted by siva <si...@bizruntime.com>.
Cache,table and index created through QueryEntities.
like below
             
cacheCfg = new CacheConfiguration
{
	...
	QueryEntities = queryList,
	...
	
};
here is the code i am executing
public static void main( String[] args ) throws ClassNotFoundException,
SQLException
    {  	
    		System.out.println( "main start!" );  		 		
    	
    		// Register JDBC driver.
    		Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
    		 
    		// Open the JDBC connection.
    		Connection conn =
DriverManager.getConnection("jdbc:ignite:thin://localhost/9E7B08B5-3BFD-4026-B322-C4A34FFFAFD7");//cacheName
    		 
    		/*
			//Select query...
			Statement stmt = conn.createStatement();
			String query = "select * from
\"9E7B08B5-3BFD-4026-B322-C4A34FFFAFD7\".ENTITIESTABLEINFO";
			boolean status = stmt.execute(query);
			if(status){
				ResultSet rs = stmt.getResultSet();
				while(rs.next()){
					System.out.println(rs.getString(1));
				}
				rs.close();
			}*/
    		
    		String sqlQuery = "INSERT INTO ENTITIESTABLEINFO
(ENTITYID,ENTITYINFOJSON,ENTITYNAME,ENTITYTYPE,FABRIC,SEQUENCENUMBER,TENANTID,TENANTNAME)"
                    + " VALUES(?, ?, ?, ?,?,?,?,?)";
		    PreparedStatement prepStmt = conn.prepareStatement(sqlQuery);
		    prepStmt.setString(1, "pulsarTesting-1-1-1-1-EntityId"); 
		    prepStmt.setString(2, "{}");
		    prepStmt.setString(3, "PulsarEntityName");
		    prepStmt.setString(4, "PulsarEntityType");
		    prepStmt.setString(5, "PulsarFabric"); 
		    prepStmt.setDouble(6, 123.0);
		    prepStmt.setString(7, "pulsar-TenantId");
		    prepStmt.setString(8, "PulsarTenant");
		    
		    prepStmt.execute();
    		
    		System.out.println("Statement executed...");
    }

here is an Exception:

Exception in thread "main" java.sql.SQLException: Failed to execute DML
statement [stmt=INSERT INTO ENTITIESTABLEINFO
(ENTITYID,ENTITYINFOJSON,ENTITYNAME,ENTITYTYPE,FABRIC,SEQUENCENUMBER,TENANTID,TENANTNAME)
VALUES(?, ?, ?, ?,?,?,?,?), params=[pulsarTesting-1-1-1-1-EntityId, aa,
PulsarEntityName, PulsarEntityType, PulsarFabric, 123.0, pulsar-TenantId,
PulsarTenant]]
	at
org.apache.ignite.internal.jdbc.thin.JdbcThinConnection.sendRequest(JdbcThinConnection.java:750)
	at
org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute0(JdbcThinStatement.java:212)
	at
org.apache.ignite.internal.jdbc.thin.JdbcThinPreparedStatement.executeWithArguments(JdbcThinPreparedStatement.java:252)
	at
org.apache.ignite.internal.jdbc.thin.JdbcThinPreparedStatement.execute(JdbcThinPreparedStatement.java:240)
	at org.apache.pulsar.io.jdbc.javaclienttest.project.App.main(App.java:133)




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Failed to execute DML statement Ignite JDBC

Posted by Evgenii Zhuravlev <e....@gmail.com>.
Hi,

Looks like the config, code and exception wasn't inserted, I don't see
anything, can you check this?

Thanks,
Evgenii

пт, 10 янв. 2020 г. в 09:25, siva <si...@bizruntime.com>:

> Hi,
> I am using Ignite v2.7.6 ,JDBC PrepareStatement to execute insert query on
> IgniteThin Driver.
>
> Cache,table and index created through QueryEntities.
> like below
>
>
> here is the code i am executing
>
>
> here is an Exception:
>
>
>
>
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>