You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2021/09/15 08:11:34 UTC

[ignite-3] branch main updated: IGNITE-15186 Implement basic JDBC client: Statement, ResultSet (#284)

This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 7e726b8  IGNITE-15186 Implement basic JDBC client: Statement, ResultSet (#284)
7e726b8 is described below

commit 7e726b83d37db053b6f08d1d629fea9346b5cdd0
Author: Vladimir Ermakov <85...@users.noreply.github.com>
AuthorDate: Wed Sep 15 11:11:27 2021 +0300

    IGNITE-15186 Implement basic JDBC client: Statement, ResultSet (#284)
---
 .../ExecutionService.java => QueryProcessor.java}  |   29 +-
 .../{exec/ExecutionService.java => SqlCursor.java} |   25 +-
 .../query/calcite/SqlQueryProcessor.java           |    7 +-
 .../ExecutionService.java => SqlQueryType.java}    |   51 +-
 .../query/calcite/exec/ExecutionService.java       |    4 +-
 .../query/calcite/exec/ExecutionServiceImpl.java   |   22 +-
 .../processors/query/calcite/util/Commons.java     |   16 +-
 .../ignite/client/proto/query/ClientMessage.java}  |   27 +-
 .../client/proto/query/IgniteQueryErrorCode.java   |   80 +
 .../client/proto/query/JdbcQueryEventHandler.java  |   64 +
 .../client/proto/query/JdbcStatementType.java}     |   40 +-
 .../ignite/client/proto/query/SqlStateCode.java    |   81 +
 .../proto/query/event/BatchExecuteRequest.java     |  120 ++
 .../proto/query/event/BatchExecuteResult.java      |   94 +
 .../ignite/client/proto/query/event/Query.java     |   87 +
 .../proto/query/event/QueryCloseRequest.java       |   70 +
 .../proto/query/event/QueryCloseResult.java}       |   36 +-
 .../proto/query/event/QueryExecuteRequest.java     |  137 ++
 .../proto/query/event/QueryExecuteResult.java      |  117 ++
 .../proto/query/event/QueryFetchRequest.java       |   86 +
 .../client/proto/query/event/QueryFetchResult.java |  123 ++
 .../proto/query/event/QuerySingleResult.java       |  189 ++
 .../ignite/client/proto/query/event/Response.java  |  134 ++
 .../client/proto/query/event/package-info.java}    |   27 +-
 .../ignite/client/proto/query/package-info.java}   |   27 +-
 .../internal/client/proto/ClientDataType.java      |    3 +
 .../internal/client/proto/ClientMessagePacker.java |  130 ++
 .../client/proto/ClientMessageUnpacker.java        |   54 +
 .../ignite/internal/client/proto/ClientOp.java     |   12 +
 .../proto/ClientMessagePackerUnpackerTest.java     |   63 +
 modules/client-handler/pom.xml                     |    5 +
 .../ignite/client/handler/ITClientHandlerTest.java |    3 +-
 .../client/handler/QueryEventHandlerTest.java      |  300 ++++
 .../ignite/client/handler/ClientHandlerModule.java |   11 +-
 .../handler/ClientInboundMessageHandler.java       |   27 +-
 .../client/handler/JdbcQueryEventHandlerImpl.java  |  239 +++
 .../requests/sql/ClientSqlCloseRequest.java        |   54 +
 .../requests/sql/ClientSqlExecuteBatchRequest.java |   54 +
 .../requests/sql/ClientSqlExecuteRequest.java      |   54 +
 .../requests/sql/ClientSqlFetchRequest.java        |   54 +
 .../client/handler/requests/sql/package-info.java} |   28 +-
 modules/client/pom.xml                             |    6 +
 .../ignite/internal/client/TcpIgniteClient.java    |   15 +
 .../client/query/JdbcClientQueryEventHandler.java  |   81 +
 .../ignite/internal/jdbc/ConnectionProperties.java |  144 ++
 .../internal/jdbc/ConnectionPropertiesImpl.java    |  843 +++++++++
 .../ignite/internal/jdbc/JdbcConnection.java       |  777 ++++++++
 .../internal/jdbc/JdbcPreparedStatement.java       |  529 ++++++
 .../apache/ignite/internal/jdbc/JdbcResultSet.java | 1891 ++++++++++++++++++++
 .../apache/ignite/internal/jdbc/JdbcStatement.java |  657 +++++++
 .../apache/ignite/internal/jdbc/package-info.java} |   28 +-
 .../org/apache/ignite/jdbc/IgniteJdbcDriver.java   |  124 ++
 .../java/org/apache/ignite/jdbc/package-info.java} |   28 +-
 .../apache/ignite/client/AbstractClientTest.java   |    2 +-
 .../org/apache/ignite/client/fakes/FakeCursor.java |   63 +
 .../org/apache/ignite/client/fakes/FakeIgnite.java |   14 +-
 .../client/fakes/FakeIgniteQueryProcessor.java}    |   36 +-
 .../runner/app/jdbc/AbstractJdbcSelfTest.java      |  114 ++
 .../app/jdbc/JdbcConnectionPropertiesTest.java     |   46 +
 .../runner/app/jdbc/JdbcConnectionSelfTest.java    | 1275 +++++++++++++
 .../runner/app/jdbc/JdbcResultSetSelfTest.java     | 1107 ++++++++++++
 .../runner/app/jdbc/JdbcStatementSelfTest.java     |  864 +++++++++
 .../org/apache/ignite/internal/app/IgniteImpl.java |    5 +-
 63 files changed, 11142 insertions(+), 291 deletions(-)

diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/QueryProcessor.java
similarity index 63%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/QueryProcessor.java
index d98fa19..1e72e97 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/QueryProcessor.java
@@ -15,31 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
+package org.apache.ignite.internal.processors.query.calcite;
 
 import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.internal.manager.IgniteComponent;
 
 /**
- *
+ * QueryProcessor interface.
  */
-public interface ExecutionService {
+public interface QueryProcessor extends IgniteComponent {
     /**
-     * Executes a query.
+     * Execute the query with given schema name and parameters.
      *
-     * @param schema Schema name.
-     * @param query Query.
+     * @param schemaName Schema name.
+     * @param qry Sql query.
      * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
-
-    /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
-     */
-    void cancelQuery(UUID queryId);
+     * @return List of sql cursors.
+     * */
+    List<SqlCursor<List<?>>> query(String schemaName, String qry, Object... params);
 }
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlCursor.java
similarity index 62%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlCursor.java
index d98fa19..b5bb641 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlCursor.java
@@ -15,31 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
-
-import java.util.List;
-import java.util.UUID;
+package org.apache.ignite.internal.processors.query.calcite;
 
 import org.apache.ignite.internal.util.Cursor;
 
 /**
+ * Sql query cursor.
  *
+ * @param <T> Type of elements.
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
-
+public interface SqlCursor<T> extends Cursor<T> {
     /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
+     * @return Query type.
      */
-    void cancelQuery(UUID queryId);
+    SqlQueryType getQueryType();
 }
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
index e2a8d47..d8ee8c1 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
@@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.query.calcite;
 
 import java.util.List;
 import org.apache.ignite.internal.manager.EventListener;
-import org.apache.ignite.internal.manager.IgniteComponent;
 import org.apache.ignite.internal.processors.query.calcite.exec.ArrayRowHandler;
 import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionService;
 import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionServiceImpl;
@@ -33,13 +32,12 @@ import org.apache.ignite.internal.table.event.TableEvent;
 import org.apache.ignite.internal.table.event.TableEventParameters;
 import org.apache.ignite.internal.thread.NamedThreadFactory;
 import org.apache.ignite.internal.thread.StripedThreadPoolExecutor;
-import org.apache.ignite.internal.util.Cursor;
 import org.apache.ignite.lang.NodeStoppingException;
 import org.apache.ignite.network.ClusterService;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-public class SqlQueryProcessor implements IgniteComponent {
+public class SqlQueryProcessor implements QueryProcessor {
     /** Default Ignite thread keep alive time. */
     public static final long DFLT_THREAD_KEEP_ALIVE_TIME = 60_000L;
 
@@ -103,7 +101,8 @@ public class SqlQueryProcessor implements IgniteComponent {
         // TODO: IGNITE-15161 Implement component's stop.
     }
 
-    public List<Cursor<List<?>>> query(String schemaName, String qry, Object... params) {
+    /** {@inheritDoc} */
+    @Override public List<SqlCursor<List<?>>> query(String schemaName, String qry, Object... params) {
         return executionSrvc.executeQuery(schemaName, qry, params);
     }
 
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryType.java
similarity index 50%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryType.java
index d98fa19..b97fef1 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryType.java
@@ -15,31 +15,42 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
+package org.apache.ignite.internal.processors.query.calcite;
 
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.internal.processors.query.calcite.prepare.QueryPlan;
 
 /**
- *
+ * Possible query types.
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
+public enum SqlQueryType {
+    /** Query. */
+    QUERY,
+
+    /** DML. */
+    DML,
+
+    /** DDL. */
+    DDL,
+
+    /** Explain. */
+    EXPLAIN;
 
     /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
+     * @param type QueryPlan.Type.
+     * @return Associated SqlQueryType.
      */
-    void cancelQuery(UUID queryId);
+    public static SqlQueryType mapPlanTypeToSqlType(QueryPlan.Type type) {
+        switch (type) {
+            case QUERY:
+                return QUERY;
+            case DML:
+                return DML;
+            case DDL:
+                return DDL;
+            case EXPLAIN:
+                return EXPLAIN;
+            default:
+                throw new UnsupportedOperationException("Unexpected query plan type: " + type.name());
+        }
+    }
 }
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
index d98fa19..f550437 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.query.calcite.exec;
 import java.util.List;
 import java.util.UUID;
 
-import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
 
 /**
  *
@@ -34,7 +34,7 @@ public interface ExecutionService {
      * @param params Query parameters.
      * @return Query cursor.
      */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
+    List<SqlCursor<List<?>>> executeQuery(String schema, String query, Object[] params);
 
     /**
      * Cancels a running query.
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
index 15e0b1c..032b3cd 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
@@ -44,6 +44,7 @@ import org.apache.calcite.sql.parser.SqlParseException;
 import org.apache.calcite.sql.type.SqlTypeName;
 import org.apache.calcite.tools.Frameworks;
 import org.apache.calcite.tools.ValidationException;
+import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
 import org.apache.ignite.internal.processors.query.calcite.exec.rel.Inbox;
 import org.apache.ignite.internal.processors.query.calcite.exec.rel.Node;
 import org.apache.ignite.internal.processors.query.calcite.exec.rel.Outbox;
@@ -89,7 +90,6 @@ import org.apache.ignite.internal.processors.query.calcite.util.NodeLeaveHandler
 import org.apache.ignite.internal.processors.query.calcite.util.TransformingIterator;
 import org.apache.ignite.internal.processors.query.calcite.util.TypeUtils;
 import org.apache.ignite.internal.util.Cancellable;
-import org.apache.ignite.internal.util.Cursor;
 import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteInternalCheckedException;
@@ -193,7 +193,7 @@ public class ExecutionServiceImpl<Row> implements ExecutionService {
     }
 
     /** {@inheritDoc} */
-    @Override public List<Cursor<List<?>>> executeQuery(
+    @Override public List<SqlCursor<List<?>>> executeQuery(
         String schema,
         String qry,
         Object[] params
@@ -211,16 +211,16 @@ public class ExecutionServiceImpl<Row> implements ExecutionService {
      * @param pctx Query context.
      * @return List of query result cursors.
      */
-    @NotNull public List<Cursor<List<?>>> executePlans(
+    @NotNull public List<SqlCursor<List<?>>> executePlans(
         Collection<QueryPlan> qryPlans,
         PlanningContext pctx
     ) {
-        List<Cursor<List<?>>> cursors = new ArrayList<>(qryPlans.size());
+        List<SqlCursor<List<?>>> cursors = new ArrayList<>(qryPlans.size());
 
         for (QueryPlan plan : qryPlans) {
             UUID qryId = UUID.randomUUID();
 
-            Cursor<List<?>> cur = executePlan(qryId, pctx, plan);
+            SqlCursor<List<?>> cur = executePlan(qryId, pctx, plan);
 
             cursors.add(cur);
         }
@@ -415,7 +415,7 @@ public class ExecutionServiceImpl<Row> implements ExecutionService {
     }
 
     /** */
-    private Cursor<List<?>> executePlan(UUID qryId, PlanningContext pctx, QueryPlan plan) {
+    private SqlCursor<List<?>> executePlan(UUID qryId, PlanningContext pctx, QueryPlan plan) {
         switch (plan.type()) {
             case DML:
                 // TODO a barrier between previous operation and this one
@@ -432,12 +432,12 @@ public class ExecutionServiceImpl<Row> implements ExecutionService {
     }
 
     /** */
-    private Cursor<List<?>> executeDdl(DdlPlan plan, PlanningContext pctx) {
+    private SqlCursor<List<?>> executeDdl(DdlPlan plan, PlanningContext pctx) {
         throw new UnsupportedOperationException("plan=" + plan + ", ctx=" + pctx);
     }
 
     /** */
-    private Cursor<List<?>> executeQuery(UUID qryId, MultiStepPlan plan, PlanningContext pctx) {
+    private SqlCursor<List<?>> executeQuery(UUID qryId, MultiStepPlan plan, PlanningContext pctx) {
         plan.init(pctx);
 
         List<Fragment> fragments = plan.fragments();
@@ -522,12 +522,12 @@ public class ExecutionServiceImpl<Row> implements ExecutionService {
                 res.add(ectx.rowHandler().get(i, row));
 
             return res;
-        }));
+        }), plan.type());
     }
 
     /** */
-    private Cursor<List<?>> executeExplain(ExplainPlan plan) {
-        Cursor<List<?>> cur = Commons.createCursor(singletonList(singletonList(plan.plan())));
+    private SqlCursor<List<?>> executeExplain(ExplainPlan plan) {
+        SqlCursor<List<?>> cur = Commons.createCursor(singletonList(singletonList(plan.plan())), plan.type());
         // TODO: fix this
 //        cur.fieldsMeta(plan.fieldsMeta().queryFieldsMetadata(pctx.typeFactory()));
 
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java
index 595f79c..b60a7a2 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java
@@ -61,15 +61,17 @@ import org.apache.calcite.util.mapping.Mapping;
 import org.apache.calcite.util.mapping.MappingType;
 import org.apache.calcite.util.mapping.Mappings;
 import org.apache.ignite.internal.generated.query.calcite.sql.IgniteSqlParserImpl;
+import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
+import org.apache.ignite.internal.processors.query.calcite.SqlQueryType;
 import org.apache.ignite.internal.processors.query.calcite.exec.exp.ExpressionFactoryImpl;
 import org.apache.ignite.internal.processors.query.calcite.metadata.cost.IgniteCostFactory;
 import org.apache.ignite.internal.processors.query.calcite.prepare.PlanningContext;
+import org.apache.ignite.internal.processors.query.calcite.prepare.QueryPlan;
 import org.apache.ignite.internal.processors.query.calcite.sql.fun.IgniteSqlOperatorTable;
 import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
 import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeSystem;
 import org.apache.ignite.internal.schema.NativeType;
 import org.apache.ignite.internal.util.ArrayUtils;
-import org.apache.ignite.internal.util.Cursor;
 import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.lang.IgniteLogger;
 import org.codehaus.commons.compiler.CompilerFactoryFactory;
@@ -132,12 +134,16 @@ public final class Commons {
     /** */
     private Commons(){}
 
-    public static <T> Cursor<T> createCursor(Iterable<T> iterable) {
-        return createCursor(iterable.iterator());
+    public static <T> SqlCursor<T> createCursor(Iterable<T> iterable, QueryPlan.Type plan) {
+        return createCursor(iterable.iterator(), plan);
     }
 
-    public static <T> Cursor<T> createCursor(Iterator<T> iter) {
-        return new Cursor<>() {
+    public static <T> SqlCursor<T> createCursor(Iterator<T> iter, QueryPlan.Type type) {
+        return new SqlCursor<>() {
+            @Override public SqlQueryType getQueryType() {
+                return SqlQueryType.mapPlanTypeToSqlType(type);
+            }
+
             @Override public void remove() {
                 iter.remove();
             }
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/ClientMessage.java
similarity index 59%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client-common/src/main/java/org/apache/ignite/client/proto/query/ClientMessage.java
index d98fa19..66fb9b8 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/ClientMessage.java
@@ -15,31 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
+package org.apache.ignite.client.proto.query;
 
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
 
 /**
- *
+ * Interface that allows to implement custom serialization logic to client events.
  */
-public interface ExecutionService {
+public interface ClientMessage {
     /**
-     * Executes a query.
+     * Writes fields to provided packer.
      *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
+     * @param packer Client message packer.
      */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
+    void writeBinary(ClientMessagePacker packer);
 
     /**
-     * Cancels a running query.
+     * Reads fields from provided reader.
      *
-     * @param queryId Query ID.
+     * @param unpacker Client message unpacker.
      */
-    void cancelQuery(UUID queryId);
+    void readBinary(ClientMessageUnpacker unpacker);
 }
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/IgniteQueryErrorCode.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/IgniteQueryErrorCode.java
new file mode 100644
index 0000000..9286ca4
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/IgniteQueryErrorCode.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query;
+
+import java.sql.SQLException;
+
+/**
+ * Error codes for query operations.
+ */
+public final class IgniteQueryErrorCode {
+    /** Unknown error, or the one without specific code. */
+    public static final int UNKNOWN = 1;
+
+    /* 1xxx - parsing errors */
+
+    /** General parsing error - for the cases when there's no more specific code available. */
+    public static final int PARSING = 1001;
+
+    /** Requested operation is not supported. */
+    public static final int UNSUPPORTED_OPERATION = 1002;
+
+    /* 2xxx - analysis errors */
+    /* 3xxx - database API related runtime errors */
+    /* 4xxx - cache related runtime errors */
+    /* 5xxx - transactions related runtime errors. */
+
+    /**
+     * Constructor.
+     * */
+    private IgniteQueryErrorCode() {
+        // No-op.
+    }
+
+    /**
+     * Create a {@link SQLException} for given code and message with detected state.
+     *
+     * @param msg Message.
+     * @param code Ignite status code.
+     * @return {@link SQLException} with given details.
+     */
+    public static SQLException createJdbcSqlException(String msg, int code) {
+        return new SQLException(msg, codeToSqlState(code));
+    }
+
+    /**
+     * Map Ignite specific error code to standard SQL state.
+     *
+     * @param statusCode Ignite specific error code.
+     * @return SQL state string.
+     * @see <a href="http://en.wikibooks.org/wiki/Structured_Query_Language/SQLSTATE">Wikipedia: SQLSTATE spec.</a>
+     * @see IgniteQueryErrorCode
+     */
+    public static String codeToSqlState(int statusCode) {
+        switch (statusCode) {
+            case UNSUPPORTED_OPERATION:
+                return SqlStateCode.UNSUPPORTED_OPERATION;
+
+            case PARSING:
+                return SqlStateCode.PARSING_EXCEPTION;
+
+            default:
+                return SqlStateCode.INTERNAL_ERROR;
+        }
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/JdbcQueryEventHandler.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/JdbcQueryEventHandler.java
new file mode 100644
index 0000000..5f90229
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/JdbcQueryEventHandler.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query;
+
+import org.apache.ignite.client.proto.query.event.BatchExecuteRequest;
+import org.apache.ignite.client.proto.query.event.BatchExecuteResult;
+import org.apache.ignite.client.proto.query.event.QueryCloseRequest;
+import org.apache.ignite.client.proto.query.event.QueryCloseResult;
+import org.apache.ignite.client.proto.query.event.QueryExecuteRequest;
+import org.apache.ignite.client.proto.query.event.QueryExecuteResult;
+import org.apache.ignite.client.proto.query.event.QueryFetchRequest;
+import org.apache.ignite.client.proto.query.event.QueryFetchResult;
+
+/**
+ * Jdbc client request handler.
+ */
+public interface JdbcQueryEventHandler {
+    /**
+     * {@link QueryExecuteRequest} command handler.
+     *
+     * @param req Execute query request.
+     * @return Result.
+     */
+    QueryExecuteResult query(QueryExecuteRequest req);
+
+    /**
+     * {@link QueryFetchRequest} command handler.
+     *
+     * @param req Fetch query request.
+     * @return Result.
+     */
+    QueryFetchResult fetch(QueryFetchRequest req);
+
+    /**
+     * {@link BatchExecuteRequest} command handler.
+     *
+     * @param req Batch query request.
+     * @return Result.
+     */
+    BatchExecuteResult batch(BatchExecuteRequest req);
+
+    /**
+     * {@link QueryCloseRequest} command handler.
+     *
+     * @param req Close query request.
+     * @return Result.
+     */
+    QueryCloseResult close(QueryCloseRequest req);
+}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/JdbcStatementType.java
similarity index 55%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client-common/src/main/java/org/apache/ignite/client/proto/query/JdbcStatementType.java
index d98fa19..4a63e7d 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/JdbcStatementType.java
@@ -15,31 +15,31 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
+package org.apache.ignite.client.proto.query;
 
 /**
- *
+ * JDBC statement type.
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
+public enum JdbcStatementType {
+    /** Any statement type. */
+    ANY_STATEMENT_TYPE,
+
+    /** Select statement type. */
+    SELECT_STATEMENT_TYPE,
+
+    /** DML / DDL statement type. */
+    UPDATE_STMT_TYPE;
+
+    /** Enumerated values. */
+    private static final JdbcStatementType[] VALS = values();
 
     /**
-     * Cancels a running query.
+     * Efficiently gets enumerated value from its ordinal.
      *
-     * @param queryId Query ID.
+     * @param ord Ordinal value.
+     * @return Enumerated value or {@code null} if ordinal out of range.
      */
-    void cancelQuery(UUID queryId);
+    public static JdbcStatementType fromOrdinal(int ord) {
+        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+    }
 }
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/SqlStateCode.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/SqlStateCode.java
new file mode 100644
index 0000000..828c791
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/SqlStateCode.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query;
+
+/**
+ * SQL state codes.
+ */
+public final class SqlStateCode {
+    /**
+     * No-op constructor to prevent instantiation.
+     */
+    private SqlStateCode() {
+        // No-op.
+    }
+
+    /** Client has failed to open connection with specified server. */
+    public static final String CLIENT_CONNECTION_FAILED = "08001";
+
+    /** Connection unexpectedly turned out to be in closed state. */
+    public static final String CONNECTION_CLOSED = "08003";
+
+    /** Connection was rejected by server. */
+    public static final String CONNECTION_REJECTED = "08004";
+
+    /** IO error during communication. */
+    public static final String CONNECTION_FAILURE = "08006";
+
+    /** Null value occurred where it wasn't expected to. */
+    public static final String NULL_VALUE = "22004";
+
+    /** Parameter type is not supported. */
+    public static final String INVALID_PARAMETER_VALUE = "22023";
+
+    /** Data integrity constraint violation. */
+    public static final String CONSTRAINT_VIOLATION = "23000";
+
+    /** Invalid result set state. */
+    public static final String INVALID_CURSOR_STATE = "24000";
+
+    /** Conversion failure. */
+    public static final String CONVERSION_FAILED = "0700B";
+
+    /** Invalid transaction level. */
+    public static final String INVALID_TRANSACTION_LEVEL = "0700E";
+
+    /** Requested operation is not supported. */
+    public static final String UNSUPPORTED_OPERATION = "0A000";
+
+    /** Transaction state exception. */
+    public static final String TRANSACTION_STATE_EXCEPTION = "25000";
+
+    /** Transaction state exception. */
+    public static final String SERIALIZATION_FAILURE = "40001";
+
+    /** Parsing exception. */
+    public static final String PARSING_EXCEPTION = "42000";
+
+    /** Internal error. */
+    public static final String INTERNAL_ERROR = "50000";  // Generic value for custom "50" class.
+
+    /** Read only mode enabled on cluster. */
+    public static final String CLUSTER_READ_ONLY_MODE_ENABLED = "90097";
+
+    /** Query canceled. */
+    public static final String QUERY_CANCELLED = "57014";
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/BatchExecuteRequest.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/BatchExecuteRequest.java
new file mode 100644
index 0000000..d080aed
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/BatchExecuteRequest.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.client.proto.query.ClientMessage;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC batch execute request.
+ */
+public class BatchExecuteRequest implements ClientMessage {
+    /** Schema name. */
+    private String schemaName;
+
+    /** Sql query. */
+    private List<Query> queries;
+
+    /** Client auto commit flag state. */
+    private boolean autoCommit;
+
+    /**
+     * Default constructor.
+     */
+    public BatchExecuteRequest() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param schemaName Schema name.
+     * @param queries Queries.
+     * @param autoCommit Client auto commit flag state.
+     */
+    public BatchExecuteRequest(String schemaName, List<Query> queries, boolean autoCommit) {
+
+        assert queries != null || !queries.isEmpty();
+
+        this.schemaName = schemaName;
+        this.queries = queries;
+        this.autoCommit = autoCommit;
+    }
+
+    /**
+     * Get the schema name.
+     *
+     * @return Schema name.
+     */
+    public String schemaName() {
+        return schemaName;
+    }
+
+    /**
+     * Get the queries.
+     *
+     * @return Queries.
+     */
+    public List<Query> queries() {
+        return queries;
+    }
+
+    /**
+     * Get the auto commit flag.
+     *
+     * @return Auto commit flag.
+     */
+    boolean autoCommit() {
+        return autoCommit;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        packer.packString(schemaName);
+
+        packer.packArrayHeader(queries.size());
+
+        for (Query q : queries)
+            q.writeBinary(packer);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        schemaName = unpacker.unpackString();
+
+        int n = unpacker.unpackArrayHeader();
+
+        queries = new ArrayList<>(n);
+
+        for (int i = 0; i < n; ++i) {
+            Query qry = new Query();
+
+            qry.readBinary(unpacker);
+
+            queries.add(qry);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(BatchExecuteRequest.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/BatchExecuteResult.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/BatchExecuteResult.java
new file mode 100644
index 0000000..983ba3c
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/BatchExecuteResult.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import java.util.Objects;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC batch execute result.
+ */
+public class BatchExecuteResult extends Response {
+    /** Update counts. */
+    private int[] updateCnts;
+
+    /**
+     * Constructor.
+     */
+    public BatchExecuteResult() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param status Status code.
+     * @param err Error message.
+     */
+    public BatchExecuteResult(int status, String err) {
+        super(status, err);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param updateCnts Update counts for batch.
+     */
+    public BatchExecuteResult(int[] updateCnts) {
+        Objects.requireNonNull(updateCnts);
+
+        this.updateCnts = updateCnts;
+
+        hasResults = true;
+    }
+
+    /**
+     * Get the update count for DML queries.
+     *
+     * @return Update count for DML queries.
+     */
+    public int[] updateCounts() {
+        return updateCnts;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        super.writeBinary(packer);
+
+        if (!hasResults)
+            return;
+
+        packer.packIntArray(updateCnts);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        super.readBinary(unpacker);
+
+        if (!hasResults)
+            return;
+
+        updateCnts = unpacker.unpackIntArray();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(BatchExecuteResult.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/Query.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/Query.java
new file mode 100644
index 0000000..0681f52
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/Query.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import org.apache.ignite.client.proto.query.ClientMessage;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC SQL query with parameters.
+ */
+public class Query implements ClientMessage {
+    /** Query SQL. */
+    private String sql;
+
+    /** Arguments. */
+    private Object[] args;
+
+    /**
+     * Default constructor is used for serialization.
+     */
+    public Query() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param sql Query SQL.
+     * @param args Arguments.
+     */
+    public Query(String sql, Object[] args) {
+        this.sql = sql;
+        this.args = args;
+    }
+
+    /**
+     * Get the sql query.
+     *
+     * @return Query SQL string.
+     */
+    public String sql() {
+        return sql;
+    }
+
+    /**
+     * Get the sql arguments.
+     *
+     * @return Query arguments.
+     */
+    public Object[] args() {
+        return args;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        packer.packString(sql);
+        packer.packObjectArray(args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        sql = unpacker.unpackString();
+        args = unpacker.unpackObjectArray();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(Query.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryCloseRequest.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryCloseRequest.java
new file mode 100644
index 0000000..24fee2e
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryCloseRequest.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import org.apache.ignite.client.proto.query.ClientMessage;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC query close request.
+ */
+public class QueryCloseRequest implements ClientMessage {
+    /** Cursor ID. */
+    private long cursorId;
+
+    /**
+     * Default constructor.
+     */
+    public QueryCloseRequest() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cursorId Cursor ID.
+     */
+    public QueryCloseRequest(long cursorId) {
+        this.cursorId = cursorId;
+    }
+
+    /**
+     * Get the cursor id.
+     *
+     * @return Cursor ID.
+     */
+    public long cursorId() {
+        return cursorId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        packer.packLong(cursorId);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        cursorId = unpacker.unpackLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(QueryCloseRequest.class, this);
+    }
+}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryCloseResult.java
similarity index 58%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryCloseResult.java
index d98fa19..a230f61 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryCloseResult.java
@@ -15,31 +15,33 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
+package org.apache.ignite.client.proto.query.event;
 
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.internal.tostring.S;
 
 /**
- *
+ * JDBC query fetch result.
  */
-public interface ExecutionService {
+public class QueryCloseResult extends Response {
     /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
+     * Default constructor is used for deserialization.
      */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
+    public QueryCloseResult() {
+        hasResults = true;
+    }
 
     /**
-     * Cancels a running query.
+     * Constructor.
      *
-     * @param queryId Query ID.
+     * @param status Status code.
+     * @param err Error message.
      */
-    void cancelQuery(UUID queryId);
+    public QueryCloseResult(int status, String err) {
+        super(status, err);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(QueryCloseResult.class, this);
+    }
 }
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteRequest.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteRequest.java
new file mode 100644
index 0000000..9f90e0f
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteRequest.java
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import org.apache.ignite.client.proto.query.ClientMessage;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC query execute request.
+ */
+public class QueryExecuteRequest implements ClientMessage {
+    /** Schema name. */
+    private String schemaName;
+
+    /** Fetch size. */
+    private int pageSize;
+
+    /** Max rows. */
+    private int maxRows;
+
+    /** Sql query. */
+    private String sqlQry;
+
+    /** Sql query arguments. */
+    private Object[] args;
+
+    /**
+     * Default constructor. For deserialization purposes.
+     */
+    public QueryExecuteRequest() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param schemaName Cache name.
+     * @param pageSize Fetch size.
+     * @param maxRows Max rows.
+     * @param sqlQry SQL query.
+     * @param args Arguments list.
+     */
+    public QueryExecuteRequest(String schemaName, int pageSize, int maxRows, String sqlQry, Object[] args) {
+
+        this.schemaName = schemaName == null || schemaName.isEmpty() ? null : schemaName;
+        this.pageSize = pageSize;
+        this.maxRows = maxRows;
+        this.sqlQry = sqlQry;
+        this.args = args;
+    }
+
+    /**
+     * Get the page size.
+     *
+     * @return Page size.
+     */
+    public int pageSize() {
+        return pageSize;
+    }
+
+    /**
+     * Get the max rows.
+     *
+     * @return Max rows.
+     */
+    public int maxRows() {
+        return maxRows;
+    }
+
+    /**
+     * Get the sql query.
+     *
+     * @return Sql query.
+     */
+    public String sqlQuery() {
+        return sqlQry;
+    }
+
+    /**
+     * Get the arguments.
+     *
+     * @return Sql query arguments.
+     */
+    public Object[] arguments() {
+        return args;
+    }
+
+    /**
+     * Get the schema name.
+     *
+     * @return Schema name.
+     */
+    public String schemaName() {
+        return schemaName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        packer.packString(schemaName);
+        packer.packInt(pageSize);
+        packer.packInt(maxRows);
+        packer.packString(sqlQry);
+
+        packer.packObjectArray(args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        schemaName = unpacker.unpackString();
+        pageSize = unpacker.unpackInt();
+        maxRows = unpacker.unpackInt();
+        sqlQry = unpacker.unpackString();
+
+        args = unpacker.unpackObjectArray();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(QueryExecuteRequest.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteResult.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteResult.java
new file mode 100644
index 0000000..a16b240
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryExecuteResult.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC query execute result.
+ */
+public class QueryExecuteResult extends Response {
+    /** Query result rows. */
+    private List<QuerySingleResult> results;
+
+    /**
+     * Constructor. For deserialization purposes only.
+     */
+    public QueryExecuteResult() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param status Status code.
+     * @param err Error message.
+     */
+    public QueryExecuteResult(int status, String err) {
+        super(status, err);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param results Results.
+     */
+    public QueryExecuteResult(List<QuerySingleResult> results) {
+        super();
+
+        Objects.requireNonNull(results);
+
+        this.results = results;
+
+        this.hasResults = true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        super.writeBinary(packer);
+
+        if (!hasResults)
+            return;
+
+        packer.packArrayHeader(results.size());
+
+        for (QuerySingleResult result : results)
+            result.writeBinary(packer);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        super.readBinary(unpacker);
+
+        if (!hasResults)
+            return;
+
+        int size = unpacker.unpackArrayHeader();
+
+        if (size == 0) {
+            results = Collections.emptyList();
+
+            return;
+        }
+
+        results = new ArrayList<>(size);
+
+        for (int i = 0; i < size; i++) {
+            var res = new QuerySingleResult();
+            res.readBinary(unpacker);
+
+            results.add(res);
+        }
+    }
+
+    /**
+     * Get the query results.
+     *
+     * @return Query result rows.
+     */
+    public List<QuerySingleResult> results() {
+        return results;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(QueryExecuteResult.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryFetchRequest.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryFetchRequest.java
new file mode 100644
index 0000000..cc1afde
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryFetchRequest.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import org.apache.ignite.client.proto.query.ClientMessage;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC query fetch request.
+ */
+public class QueryFetchRequest implements ClientMessage {
+    /** Cursor ID. */
+    private long cursorId;
+
+    /** Fetch size. */
+    private int pageSize;
+
+    /**
+     * Constructor.
+     */
+    public QueryFetchRequest() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cursorId Cursor ID.
+     * @param pageSize Fetch size.
+     */
+    public QueryFetchRequest(long cursorId, int pageSize) {
+        this.cursorId = cursorId;
+        this.pageSize = pageSize;
+    }
+
+    /**
+     * Get the cursor id.
+     *
+     * @return Cursor ID.
+     */
+    public long cursorId() {
+        return cursorId;
+    }
+
+    /**
+     * Get the fetch page size.
+     *
+     * @return Fetch page size.
+     */
+    public int pageSize() {
+        return pageSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        packer.packLong(cursorId);
+        packer.packInt(pageSize);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        cursorId = unpacker.unpackLong();
+        pageSize = unpacker.unpackInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(QueryFetchRequest.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryFetchResult.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryFetchResult.java
new file mode 100644
index 0000000..50bd49c
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QueryFetchResult.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC query fetch result.
+ */
+public class QueryFetchResult extends Response {
+    /** Query result rows. */
+    private List<List<Object>> items;
+
+    /** Flag indicating the query has no unfetched results. */
+    private boolean last;
+
+    /**
+     * Default constructor is used for deserialization.
+     */
+    public QueryFetchResult() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param status Status code.
+     * @param err Error message.
+     */
+    public QueryFetchResult(int status, String err) {
+        super(status, err);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param items Query result rows.
+     * @param last Flag indicating the query has no unfetched results.
+     */
+    public QueryFetchResult(List<List<Object>> items, boolean last) {
+        Objects.requireNonNull(items);
+
+        this.items = items;
+        this.last = last;
+
+        hasResults = true;
+    }
+
+    /**
+     * Get the result rows.
+     *
+     * @return Query result rows.
+     */
+    public List<List<Object>> items() {
+        return items;
+    }
+
+    /**
+     * Get the last flag.
+     *
+     * @return Flag indicating the query has no unfetched results.
+     */
+    public boolean last() {
+        return last;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        super.writeBinary(packer);
+
+        if (!hasResults)
+            return;
+
+        packer.packBoolean(last);
+
+        packer.packArrayHeader(items.size());
+
+        for (List<Object> item : items)
+            packer.packObjectArray(item.toArray());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        super.readBinary(unpacker);
+
+        if (!hasResults)
+            return;
+
+        last = unpacker.unpackBoolean();
+
+        int size = unpacker.unpackArrayHeader();
+
+        items = new ArrayList<>(size);
+
+        for (int i = 0; i < size; i++)
+            items.add(Arrays.asList(unpacker.unpackObjectArray()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(QueryFetchResult.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QuerySingleResult.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QuerySingleResult.java
new file mode 100644
index 0000000..d903852
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/QuerySingleResult.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * JDBC query execute result.
+ */
+public class QuerySingleResult extends Response {
+    /** Cursor ID. */
+    private long cursorId;
+
+    /** Query result rows. */
+    private List<List<Object>> items;
+
+    /** Flag indicating the query has no unfetched results. */
+    private boolean last;
+
+    /** Flag indicating the query is SELECT query. {@code false} for DML/DDL queries. */
+    private boolean isQuery;
+
+    /** Update count. */
+    private long updateCnt;
+
+    /**
+     * Constructor. For deserialization purposes only.
+     */
+    public QuerySingleResult() {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param status Status code.
+     * @param err Error message.
+     */
+    public QuerySingleResult(int status, String err) {
+        super(status, err);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cursorId Cursor ID.
+     * @param items Query result rows.
+     * @param last Flag indicates the query has no unfetched results.
+     */
+    public QuerySingleResult(long cursorId, List<List<Object>> items, boolean last) {
+        super();
+
+        Objects.requireNonNull(items);
+
+        this.cursorId = cursorId;
+        this.items = items;
+        this.last = last;
+        this.isQuery = true;
+
+        hasResults = true;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param cursorId Cursor ID.
+     * @param updateCnt Update count for DML queries.
+     */
+    public QuerySingleResult(long cursorId, long updateCnt) {
+        super();
+
+        this.cursorId = cursorId;
+        this.last = true;
+        this.isQuery = false;
+        this.updateCnt = updateCnt;
+        this.items = Collections.emptyList();
+
+        hasResults = true;
+    }
+
+    /**
+     * Get the cursor id.
+     *
+     * @return Cursor ID.
+     */
+    public long cursorId() {
+        return cursorId;
+    }
+
+    /**
+     * Get the items.
+     *
+     * @return Query result rows.
+     */
+    public List<List<Object>> items() {
+        return items;
+    }
+
+    /**
+     * Get the last flag.
+     *
+     * @return Flag indicating the query has no unfetched results.
+     */
+    public boolean last() {
+        return last;
+    }
+
+    /**
+     * Get the isQuery flag.
+     *
+     * @return Flag indicating the query is SELECT query. {@code false} for DML/DDL queries.
+     */
+    public boolean isQuery() {
+        return isQuery;
+    }
+
+    /**
+     * Get the update count.
+     *
+     * @return Update count for DML queries.
+     */
+    public long updateCount() {
+        return updateCnt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        super.writeBinary(packer);
+
+        if (!hasResults)
+            return;
+
+        packer.packLong(cursorId);
+        packer.packBoolean(isQuery);
+        packer.packLong(updateCnt);
+        packer.packBoolean(last);
+
+        packer.packArrayHeader(items.size());
+
+        for (List<Object> item : items)
+            packer.packObjectArray(item.toArray());
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        super.readBinary(unpacker);
+
+        if (!hasResults)
+            return;
+
+        cursorId = unpacker.unpackLong();
+        isQuery = unpacker.unpackBoolean();
+        updateCnt = unpacker.unpackLong();
+        last = unpacker.unpackBoolean();
+
+        int size = unpacker.unpackArrayHeader();
+
+        items = new ArrayList<>(size);
+
+        for (int i = 0; i < size; i++)
+            items.add(Arrays.asList(unpacker.unpackObjectArray()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(QuerySingleResult.class, this);
+    }
+}
diff --git a/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/Response.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/Response.java
new file mode 100644
index 0000000..54abe4b
--- /dev/null
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/Response.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.proto.query.event;
+
+import io.netty.util.internal.StringUtil;
+import org.apache.ignite.client.proto.query.ClientMessage;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+import org.apache.ignite.internal.tostring.S;
+
+/**
+ * SQL listener response.
+ */
+public abstract class Response implements ClientMessage {
+    /** Command succeeded. */
+    public static final int STATUS_SUCCESS = 0;
+
+    /** Command failed. */
+    public static final int STATUS_FAILED = 1;
+
+    /** Success status. */
+    private int status;
+
+    /** Error. */
+    private String err;
+
+    /** Has results. */
+    protected boolean hasResults;
+
+    /**
+     * Constructs successful response.
+     */
+    protected Response() {
+        status = STATUS_SUCCESS;
+    }
+
+    /**
+     * Constructs failed rest response.
+     *
+     * @param status Response status.
+     * @param err Error, {@code null} if success is {@code true}.
+     */
+    protected Response(int status, String err) {
+        assert status != STATUS_SUCCESS;
+
+        this.status = status;
+        this.err = err;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBinary(ClientMessagePacker packer) {
+        packer.packBoolean(hasResults);
+        packer.packInt(status);
+
+        if (StringUtil.isNullOrEmpty(err))
+            packer.packNil();
+        else
+            packer.packString(err);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readBinary(ClientMessageUnpacker unpacker) {
+        hasResults = unpacker.unpackBoolean();
+        status = unpacker.unpackInt();
+
+        if (!unpacker.tryUnpackNil())
+            err = unpacker.unpackString();
+    }
+
+    /**
+     * Get the status.
+     *
+     * @return Status.
+     */
+    public int status() {
+        return status;
+    }
+
+    /**
+     * Set the status.
+     *
+     * @param status Status.
+     */
+    public void status(int status) {
+        this.status = status;
+    }
+
+    /**
+     * Gets the error.
+     *
+     * @return Error.
+     */
+    public String err() {
+        return err;
+    }
+
+    /**
+     * Set the error message.
+     *
+     * @param err Error.
+     */
+    public void err(String err) {
+        this.err = err;
+    }
+
+    /**
+     * Gets hasResults flag.
+     *
+     * @return Has results.
+     */
+    public boolean hasResults() {
+        return hasResults;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(Response.class, this);
+    }
+}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/package-info.java
similarity index 57%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/package-info.java
index d98fa19..bf2c002 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/event/package-info.java
@@ -15,31 +15,8 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
-
 /**
- *
+ * Ignite thin client jdbc events.
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
 
-    /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
-     */
-    void cancelQuery(UUID queryId);
-}
+package org.apache.ignite.client.proto.query.event;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/package-info.java
similarity index 57%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client-common/src/main/java/org/apache/ignite/client/proto/query/package-info.java
index d98fa19..6339521 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/client/proto/query/package-info.java
@@ -15,31 +15,8 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
-
 /**
- *
+ * Ignite thin client sql query shared logic (client and server: events, state codes, handlers, etc).
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
 
-    /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
-     */
-    void cancelQuery(UUID queryId);
-}
+package org.apache.ignite.client.proto.query;
diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientDataType.java b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientDataType.java
index f852703..603127e 100644
--- a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientDataType.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientDataType.java
@@ -68,4 +68,7 @@ public class ClientDataType {
 
     /** Number. */
     public static final int NUMBER = 16;
+
+    /** Boolean. */
+    public static final int BOOLEAN = 17;
 }
diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessagePacker.java b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessagePacker.java
index a93e891..f268373 100644
--- a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessagePacker.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessagePacker.java
@@ -22,6 +22,9 @@ import java.io.UncheckedIOException;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -383,6 +386,29 @@ public class ClientMessagePacker extends MessagePacker {
     }
 
     /**
+     * Writes an integer array.
+     *
+     * @param arr Integer array value.
+     * @return This instance.
+     */
+    public ClientMessagePacker packIntArray(int[] arr) {
+        assert !closed : "Packer is closed";
+
+        if (arr == null) {
+            packNil();
+
+            return this;
+        }
+
+        packArrayHeader(arr.length);
+
+        for (int i : arr)
+            packInt(i);
+
+        return this;
+    }
+
+    /**
      * Writes a date.
      *
      * @param val Date value.
@@ -550,6 +576,110 @@ public class ClientMessagePacker extends MessagePacker {
         throw new UnsupportedOperationException("Unsupported type, can't serialize: " + val.getClass());
     }
 
+    /**
+     * Packs an array of different objects.
+     *
+     * @param args Object array.
+     * @return This instance.
+     * @throws UnsupportedOperationException in case of unknown type.
+     */
+    public ClientMessagePacker packObjectArray(Object[] args) {
+        assert !closed : "Packer is closed";
+
+        if (args == null) {
+            packNil();
+
+            return this;
+        }
+
+        packArrayHeader(args.length);
+
+        for (Object arg : args) {
+            if (arg == null) {
+                packNil();
+
+                continue;
+            }
+
+            Class<?> cls = arg.getClass();
+
+            if (cls == Boolean.class) {
+                packInt(ClientDataType.BOOLEAN);
+                packBoolean((Boolean)arg);
+            }
+            else if (cls == Byte.class) {
+                packInt(ClientDataType.INT8);
+                packByte((Byte)arg);
+            }
+            else if (cls == Short.class) {
+                packInt(ClientDataType.INT16);
+                packShort((Short)arg);
+            }
+            else if (cls == Integer.class) {
+                packInt(ClientDataType.INT32);
+                packInt((Integer)arg);
+            }
+            else if (cls == Long.class) {
+                packInt(ClientDataType.INT64);
+                packLong((Long)arg);
+            }
+            else if (cls == Float.class) {
+                packInt(ClientDataType.FLOAT);
+                packFloat((Float)arg);
+            }
+            else if (cls == Double.class) {
+                packInt(ClientDataType.DOUBLE);
+                packDouble((Double)arg);
+            }
+            else if (cls == String.class) {
+                packInt(ClientDataType.STRING);
+                packString((String)arg);
+            }
+            else if (cls == UUID.class) {
+                packInt(ClientDataType.UUID);
+                packUuid((UUID)arg);
+            }
+            else if (cls == LocalDate.class) {
+                packInt(ClientDataType.DATE);
+                packDate((LocalDate)arg);
+            }
+            else if (cls == LocalTime.class) {
+                packInt(ClientDataType.TIME);
+                packTime((LocalTime)arg);
+            }
+            else if (cls == LocalDateTime.class) {
+                packInt(ClientDataType.DATETIME);
+                packDateTime((LocalDateTime)arg);
+            }
+            else if (cls == Instant.class) {
+                packInt(ClientDataType.TIMESTAMP);
+                packTimestamp((Instant)arg);
+            }
+            else if (cls == byte[].class) {
+                packInt(ClientDataType.BYTES);
+
+                packBinaryHeader(((byte[])arg).length);
+                writePayload((byte[])arg);
+            }
+            else if (cls == Date.class) {
+                packInt(ClientDataType.DATE);
+                packDate(((Date)arg).toLocalDate());
+            }
+            else if (cls == Time.class) {
+                packInt(ClientDataType.TIME);
+                packTime(((Time)arg).toLocalTime());
+            }
+            else if (cls == Timestamp.class) {
+                packInt(ClientDataType.TIMESTAMP);
+                packTimestamp(((java.util.Date)arg).toInstant());
+            }
+            else
+                throw new UnsupportedOperationException("Custom objects are not supported");
+        }
+
+        return this;
+    }
+
     /** {@inheritDoc} */
     @Override public void close() {
         if (closed)
diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessageUnpacker.java b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessageUnpacker.java
index b2bc8c4..8975509 100644
--- a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessageUnpacker.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientMessageUnpacker.java
@@ -30,6 +30,7 @@ import java.util.BitSet;
 import java.util.UUID;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufInputStream;
+import org.apache.ignite.internal.util.ArrayUtils;
 import org.apache.ignite.lang.IgniteException;
 import org.msgpack.core.ExtensionTypeHeader;
 import org.msgpack.core.MessageFormat;
@@ -41,6 +42,7 @@ import org.msgpack.core.buffer.InputStreamBufferInput;
 import org.msgpack.value.ImmutableValue;
 
 import static org.apache.ignite.internal.client.proto.ClientDataType.BITMASK;
+import static org.apache.ignite.internal.client.proto.ClientDataType.BOOLEAN;
 import static org.apache.ignite.internal.client.proto.ClientDataType.BYTES;
 import static org.apache.ignite.internal.client.proto.ClientDataType.DATE;
 import static org.apache.ignite.internal.client.proto.ClientDataType.DATETIME;
@@ -414,6 +416,27 @@ public class ClientMessageUnpacker extends MessageUnpacker {
     }
 
     /**
+     * Reads an integer array.
+     *
+     * @return Integer array.
+     */
+    public int[] unpackIntArray() {
+        assert refCnt > 0 : "Unpacker is closed";
+
+        int size = unpackArrayHeader();
+
+        if (size == 0)
+            return ArrayUtils.INT_EMPTY_ARRAY;
+
+        int[] res = new int[size];
+
+        for (int i = 0; i < size; i++)
+            res[i] = unpackInt();
+
+        return res;
+    }
+
+    /**
      * Reads a date.
      *
      * @return Date value.
@@ -529,6 +552,9 @@ public class ClientMessageUnpacker extends MessageUnpacker {
             return null;
 
         switch (dataType) {
+            case BOOLEAN:
+                return unpackBoolean();
+
             case INT8:
                 return unpackByte();
 
@@ -585,6 +611,34 @@ public class ClientMessageUnpacker extends MessageUnpacker {
     }
 
     /**
+     * Packs an object.
+     *
+     * @return Object array.
+     * @throws IllegalStateException in case of unexpected value type.
+     */
+    public Object[] unpackObjectArray() {
+        assert refCnt > 0 : "Unpacker is closed";
+
+        if (tryUnpackNil())
+            return null;
+
+        int size = unpackArrayHeader();
+
+        if (size == 0)
+            return ArrayUtils.OBJECT_EMPTY_ARRAY;
+
+        Object[] args = new Object[size];
+
+        for (int i = 0; i < size; i++) {
+            if (tryUnpackNil())
+                continue;
+
+            args[i] = unpackObject(unpackInt());
+        }
+        return args;
+    }
+
+    /**
      * Creates a copy of this unpacker and the underlying buffer.
      *
      * @return Copied unpacker.
diff --git a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientOp.java b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientOp.java
index f3851c3..fb23495 100644
--- a/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientOp.java
+++ b/modules/client-common/src/main/java/org/apache/ignite/internal/client/proto/ClientOp.java
@@ -107,4 +107,16 @@ public class ClientOp {
 
     /** Check if the tuple with the given key exists. */
     public static final int TUPLE_CONTAINS_KEY = 33;
+
+    /** Execute sql query. */
+    public static final int SQL_EXEC = 34;
+
+    /** Get next batch by query cursor. */
+    public static final int SQL_NEXT = 35;
+
+    /** Execute batch query. */
+    public static final int SQL_EXEC_BATCH = 36;
+
+    /** Close query cursor. */
+    public static final int SQL_CURSOR_CLOSE = 37;
 }
diff --git a/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ClientMessagePackerUnpackerTest.java b/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ClientMessagePackerUnpackerTest.java
index 0364ca3..627c40d 100644
--- a/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ClientMessagePackerUnpackerTest.java
+++ b/modules/client-common/src/test/java/org/apache/ignite/internal/client/proto/ClientMessagePackerUnpackerTest.java
@@ -256,4 +256,67 @@ public class ClientMessagePackerUnpackerTest {
             }
         }
     }
+
+    @Test
+    public void testIntegerArray() {
+        try (var packer = new ClientMessagePacker(PooledByteBufAllocator.DEFAULT.directBuffer())) {
+            int[] arr = new int[] {4, 8, 15, 16, 23, 42};
+
+            packer.packIntArray(arr);
+
+            var buf = packer.getBuffer();
+
+            byte[] data = new byte[buf.readableBytes()];
+
+            buf.readBytes(data);
+
+            try (var unpacker = new ClientMessageUnpacker(Unpooled.wrappedBuffer(data))) {
+                unpacker.skipValue(4);
+                int[] res = unpacker.unpackIntArray();
+                assertArrayEquals(arr, res);
+            }
+        }
+    }
+
+    @Test
+    public void testObjectArray() {
+        try (var packer = new ClientMessagePacker(PooledByteBufAllocator.DEFAULT.directBuffer())) {
+            Object[] args = new Object[] {(byte)4, (short)8, 15, 16L, 23.0f, 42.0d, "TEST_STRING", null, UUID.randomUUID(), false};
+            packer.packObjectArray(args);
+
+            var buf = packer.getBuffer();
+
+            byte[] data = new byte[buf.readableBytes()];
+
+            buf.readBytes(data);
+
+            try (var unpacker = new ClientMessageUnpacker(Unpooled.wrappedBuffer(data))) {
+                unpacker.skipValue(4);
+                Object[] res = unpacker.unpackObjectArray();
+                assertArrayEquals(args, res);
+            }
+        }
+    }
+
+    @Test
+    public void testObjectArrayLongValue() {
+        try (var packer = new ClientMessagePacker(PooledByteBufAllocator.DEFAULT.directBuffer())) {
+            Object[] args = new Object[] {16L};
+            packer.packObjectArray(args);
+
+            var buf = packer.getBuffer();
+
+            byte[] data = new byte[buf.readableBytes()];
+
+            buf.readBytes(data);
+
+            try (var unpacker = new ClientMessageUnpacker(Unpooled.wrappedBuffer(data))) {
+                unpacker.skipValue(4);
+
+                Object[] res = unpacker.unpackObjectArray();
+
+                assertEquals(16L,(Long) res[0]);
+            }
+        }
+    }
 }
diff --git a/modules/client-handler/pom.xml b/modules/client-handler/pom.xml
index 5762b7a..0ecb6aa 100644
--- a/modules/client-handler/pom.xml
+++ b/modules/client-handler/pom.xml
@@ -53,6 +53,11 @@
             <artifactId>ignite-table</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-calcite</artifactId>
+        </dependency>
+
         <!-- 3rd party dependencies -->
         <dependency>
             <groupId>com.google.code.gson</groupId>
diff --git a/modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/ITClientHandlerTest.java b/modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/ITClientHandlerTest.java
index 5ad5cc9..dc44eb0 100644
--- a/modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/ITClientHandlerTest.java
+++ b/modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/ITClientHandlerTest.java
@@ -27,6 +27,7 @@ import java.util.Objects;
 import org.apache.ignite.configuration.schemas.clientconnector.ClientConnectorConfiguration;
 import org.apache.ignite.internal.configuration.ConfigurationManager;
 import org.apache.ignite.internal.configuration.storage.TestConfigurationStorage;
+import org.apache.ignite.internal.processors.query.calcite.QueryProcessor;
 import org.apache.ignite.table.manager.IgniteTables;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -191,7 +192,7 @@ public class ITClientHandlerTest {
                 local -> local.changePort(10800).changePortRange(10)
         ).join();
 
-        var module = new ClientHandlerModule(mock(IgniteTables.class), registry);
+        var module = new ClientHandlerModule(mock(QueryProcessor.class), mock(IgniteTables.class), registry);
 
         module.start();
 
diff --git a/modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/QueryEventHandlerTest.java b/modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/QueryEventHandlerTest.java
new file mode 100644
index 0000000..d74bc1f
--- /dev/null
+++ b/modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/QueryEventHandlerTest.java
@@ -0,0 +1,300 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.handler;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.event.BatchExecuteRequest;
+import org.apache.ignite.client.proto.query.event.BatchExecuteResult;
+import org.apache.ignite.client.proto.query.event.Query;
+import org.apache.ignite.client.proto.query.event.QueryCloseRequest;
+import org.apache.ignite.client.proto.query.event.QueryCloseResult;
+import org.apache.ignite.client.proto.query.event.QueryExecuteRequest;
+import org.apache.ignite.client.proto.query.event.QueryExecuteResult;
+import org.apache.ignite.client.proto.query.event.QueryFetchRequest;
+import org.apache.ignite.client.proto.query.event.QueryFetchResult;
+import org.apache.ignite.client.proto.query.event.QuerySingleResult;
+import org.apache.ignite.internal.processors.query.calcite.QueryProcessor;
+import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
+import org.apache.ignite.internal.processors.query.calcite.SqlQueryType;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import static org.apache.ignite.client.proto.query.IgniteQueryErrorCode.UNSUPPORTED_OPERATION;
+import static org.apache.ignite.client.proto.query.event.Response.STATUS_FAILED;
+import static org.apache.ignite.client.proto.query.event.Response.STATUS_SUCCESS;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
+/**
+ * Test QueryEventHandler implementation with various request types.
+ * */
+@ExtendWith(MockitoExtension.class)
+public class QueryEventHandlerTest {
+    /**
+     * Mocked query processor.
+     */
+    @Mock
+    private QueryProcessor processor;
+
+    /**
+     * Mocked sql cursor.
+     */
+    @Mock
+    private SqlCursor<List<?>> cursor;
+
+    /**
+     * Test multiple select query request.
+     */
+    @Test
+    public void testSelectQueryRequestMultipleStatements() {
+        int cursorSize = 10;
+
+        JdbcQueryEventHandler hnd = prepareHandlerForMultiState(cursorSize);
+
+        QueryExecuteRequest qryReq = getJdbcQueryExecuteRequest(10);
+
+        QueryExecuteResult res = hnd.query(qryReq);
+
+        assertEquals(res.status(), STATUS_SUCCESS);
+        assertNull(res.err());
+
+        assertEquals(res.results().size(), cursorSize);
+
+        for (int i = 0; i < res.results().size(); i++) {
+            QuerySingleResult singleRes = res.results().get(i);
+            assertTrue(singleRes.isQuery());
+            assertFalse(singleRes.last());
+            assertEquals(singleRes.cursorId(), i);
+
+            assertEquals(singleRes.items().size(), 10);
+            assertEquals(singleRes.items().get(0).size(), 1);
+
+            assertEquals(singleRes.items().get(0).get(0), "42");
+        }
+    }
+
+    /**
+     * Prepare cursors and processor for multiple select query request.
+     *
+     * @param cursorSize Size of the cursors array.
+     * @return Query event handler.
+     */
+    private JdbcQueryEventHandler prepareHandlerForMultiState(int cursorSize) {
+        when(cursor.getQueryType()).thenReturn(SqlQueryType.QUERY);
+        when(cursor.hasNext()).thenReturn(true);
+
+        doReturn(Collections.singletonList("42")).when(cursor).next();
+
+        List<SqlCursor<List<?>>> cursors = new ArrayList<>(cursorSize);
+
+        for (int i = 0; i < cursorSize; i++)
+            cursors.add(cursor);
+
+        when(processor.query(anyString(), anyString(), any())).thenReturn(cursors);
+
+        return new JdbcQueryEventHandlerImpl(processor);
+    }
+
+    /**
+     * Test fetch query request.
+     */
+    @Test
+    public void testFetchQueryRequest() {
+        JdbcQueryEventHandler hnd = getHandler(SqlQueryType.QUERY, "42");
+
+        QueryExecuteRequest qryReq = getJdbcQueryExecuteRequest(10);
+
+        QueryExecuteResult qryRes = hnd.query(qryReq);
+
+        var fetchReq = new QueryFetchRequest(qryRes.results().get(0).cursorId(), 10);
+
+        QueryFetchResult fetchRes = hnd.fetch(fetchReq);
+
+        assertEquals(fetchRes.status(), STATUS_SUCCESS);
+        assertNull(fetchRes.err());
+
+        assertEquals(fetchRes.items().size(), 10);
+
+        assertEquals(fetchRes.items().get(0).get(0), "42");
+    }
+
+    /**
+     * Test dml query request.
+     */
+    @Test
+    public void testDMLQuery() {
+        JdbcQueryEventHandler hnd = getHandler(SqlQueryType.DML, 1L);
+
+        when(cursor.hasNext()).thenReturn(true).thenReturn(false);
+
+        QueryExecuteRequest qryReq = getJdbcQueryExecuteRequest(10);
+
+        QueryExecuteResult res = hnd.query(qryReq);
+
+        assertEquals(res.status(), STATUS_SUCCESS);
+        assertNull(res.err());
+
+        assertEquals(res.results().size(), 1);
+
+        QuerySingleResult singleRes = res.results().get(0);
+
+        assertEquals(singleRes.updateCount(), 1L);
+        assertFalse(singleRes.isQuery());
+        assertTrue(singleRes.last());
+    }
+
+    /**
+     * Test batch query request.
+     */
+    @Test
+    public void testBatchQuery() {
+        JdbcQueryEventHandler hnd = new JdbcQueryEventHandlerImpl(processor);
+
+        var req = new BatchExecuteRequest(
+            "PUBLIC",
+            Collections.singletonList(new Query("INSERT INTRO test VALUES (1);", null)),
+            false);
+
+        BatchExecuteResult batch = hnd.batch(req);
+
+        assertEquals(batch.status(), UNSUPPORTED_OPERATION);
+        assertNotNull(batch.err());
+    }
+
+    /**
+     * Test error cases for select query request.
+     */
+    @Test
+    public void testSelectQueryBadRequest() {
+        JdbcQueryEventHandler hnd = new JdbcQueryEventHandlerImpl(processor);
+
+        QueryExecuteRequest qryReq = getJdbcQueryExecuteRequest(10);
+
+        QueryExecuteResult res1 = hnd.query(qryReq);
+
+        assertEquals(res1.status(), STATUS_FAILED);
+        assertNotNull(res1.err());
+
+        QueryExecuteRequest req2 = getJdbcQueryExecuteRequest(10);
+
+        when(processor.query(anyString(), anyString(), any())).thenReturn(Collections.emptyList());
+
+        QueryExecuteResult res2 = hnd.query(req2);
+
+        assertEquals(res2.status(), STATUS_FAILED);
+        assertNotNull(res2.err());
+
+        when(cursor.hasNext()).thenReturn(true);
+        when(cursor.next()).thenThrow(RuntimeException.class);
+        when(processor.query(anyString(), anyString(), any())).thenReturn(Collections.singletonList(cursor));
+
+        QueryExecuteResult res3 = hnd.query(req2);
+
+        assertEquals(res3.status(), STATUS_FAILED);
+        assertNotNull(res3.err());
+    }
+
+    /**
+     * Test error cases for fetch query request.
+     */
+    @Test
+    public void testFetchQueryBadRequests() {
+        JdbcQueryEventHandler hnd = getHandler(SqlQueryType.QUERY, "42");
+
+        QueryExecuteRequest qryReq = getJdbcQueryExecuteRequest(1);
+
+        QueryExecuteResult qryRes = hnd.query(qryReq);
+
+        var fetchReq = new QueryFetchRequest(qryRes.results().get(0).cursorId(), -1);
+
+        QueryFetchResult fetchRes = hnd.fetch(fetchReq);
+
+        assertEquals(fetchRes.status(), STATUS_FAILED);
+        assertNotNull(fetchRes.err());
+
+        fetchReq = new QueryFetchRequest(Integer.MAX_VALUE, 1);
+
+        fetchRes = hnd.fetch(fetchReq);
+
+        assertEquals(fetchRes.status(), STATUS_FAILED);
+        assertNotNull(fetchRes.err());
+    }
+
+    /**
+     * Test close cursor request.
+     */
+    @Test
+    public void testCloseRequest() {
+        JdbcQueryEventHandler hnd = getHandler(SqlQueryType.QUERY, "42");
+
+        QueryExecuteRequest qryReq = getJdbcQueryExecuteRequest(1);
+
+        QueryExecuteResult qryRes = hnd.query(qryReq);
+
+        var closeReq = new QueryCloseRequest(qryRes.results().get(0).cursorId());
+
+        QueryCloseResult closeRes = hnd.close(closeReq);
+
+        assertEquals(closeRes.status(), STATUS_SUCCESS);
+
+        closeRes = hnd.close(closeReq);
+
+        assertEquals(closeRes.status(), STATUS_FAILED);
+        assertNotNull(closeRes.err());
+    }
+
+    /**
+     * Prepare getJdbcQueryExecuteRequest.
+     *
+     * @param pageSize Size of result set in response.
+     * @return JdbcQueryExecuteRequest.
+     */
+    private QueryExecuteRequest getJdbcQueryExecuteRequest(int pageSize) {
+        return new QueryExecuteRequest("PUBLIC", pageSize, 3, "SELECT * FROM Test;", null);
+    }
+
+    /**
+     * Prepare cursor and processor for multiple select query request.
+     *
+     * @param type Expected sql query type.
+     * @param val Value in result set.
+     * @return Query event handler.
+     */
+    private JdbcQueryEventHandler getHandler(SqlQueryType type, Object val) {
+        when(cursor.getQueryType()).thenReturn(type);
+        when(cursor.hasNext()).thenReturn(true);
+
+        doReturn(Collections.singletonList(val)).when(cursor).next();
+
+        when(processor.query(anyString(), anyString(), any())).thenReturn(Collections.singletonList(cursor));
+
+        return new JdbcQueryEventHandlerImpl(processor);
+    }
+}
diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java
index 71ca0c8..75ea110 100644
--- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientHandlerModule.java
@@ -32,6 +32,7 @@ import org.apache.ignite.configuration.schemas.clientconnector.ClientConnectorCo
 import org.apache.ignite.internal.client.proto.ClientMessageDecoder;
 import org.apache.ignite.internal.configuration.ConfigurationRegistry;
 import org.apache.ignite.internal.manager.IgniteComponent;
+import org.apache.ignite.internal.processors.query.calcite.QueryProcessor;
 import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.lang.IgniteLogger;
 import org.apache.ignite.table.manager.IgniteTables;
@@ -53,16 +54,22 @@ public class ClientHandlerModule implements IgniteComponent {
     /** Netty channel. */
     private volatile Channel channel;
 
+    /** Processor. */
+    private QueryProcessor processor;
+
     /**
      * Constructor.
      *
+     * @param processor Sql query processor.
      * @param igniteTables Ignite.
      * @param registry Configuration registry.
      */
-    public ClientHandlerModule(IgniteTables igniteTables, ConfigurationRegistry registry) {
+    public ClientHandlerModule(QueryProcessor processor, IgniteTables igniteTables, ConfigurationRegistry registry) {
         assert igniteTables != null;
         assert registry != null;
+        assert processor != null;
 
+        this.processor = processor;
         this.igniteTables = igniteTables;
         this.registry = registry;
     }
@@ -125,7 +132,7 @@ public class ClientHandlerModule implements IgniteComponent {
                 protected void initChannel(Channel ch) {
                     ch.pipeline().addLast(
                             new ClientMessageDecoder(),
-                            new ClientInboundMessageHandler(igniteTables));
+                            new ClientInboundMessageHandler(igniteTables, processor));
                 }
             })
             .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, configuration.connectTimeout())
diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java
index 8172b34..d6d22e3 100644
--- a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java
@@ -24,6 +24,10 @@ import io.netty.buffer.ByteBufAllocator;
 import io.netty.buffer.Unpooled;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
+import org.apache.ignite.client.handler.requests.sql.ClientSqlCloseRequest;
+import org.apache.ignite.client.handler.requests.sql.ClientSqlExecuteBatchRequest;
+import org.apache.ignite.client.handler.requests.sql.ClientSqlExecuteRequest;
+import org.apache.ignite.client.handler.requests.sql.ClientSqlFetchRequest;
 import org.apache.ignite.client.handler.requests.table.ClientSchemasGetRequest;
 import org.apache.ignite.client.handler.requests.table.ClientTableDropRequest;
 import org.apache.ignite.client.handler.requests.table.ClientTableGetRequest;
@@ -52,6 +56,7 @@ import org.apache.ignite.client.handler.requests.table.ClientTupleUpsertAllReque
 import org.apache.ignite.client.handler.requests.table.ClientTupleUpsertAllSchemalessRequest;
 import org.apache.ignite.client.handler.requests.table.ClientTupleUpsertRequest;
 import org.apache.ignite.client.handler.requests.table.ClientTupleUpsertSchemalessRequest;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
 import org.apache.ignite.internal.client.proto.ClientErrorCode;
 import org.apache.ignite.internal.client.proto.ClientMessageCommon;
 import org.apache.ignite.internal.client.proto.ClientMessagePacker;
@@ -59,6 +64,7 @@ import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
 import org.apache.ignite.internal.client.proto.ClientOp;
 import org.apache.ignite.internal.client.proto.ProtocolVersion;
 import org.apache.ignite.internal.client.proto.ServerMessageType;
+import org.apache.ignite.internal.processors.query.calcite.QueryProcessor;
 import org.apache.ignite.lang.IgniteException;
 import org.apache.ignite.lang.IgniteLogger;
 import org.apache.ignite.table.manager.IgniteTables;
@@ -77,15 +83,22 @@ public class ClientInboundMessageHandler extends ChannelInboundHandlerAdapter {
     /** Context. */
     private ClientContext clientContext;
 
+    /** Handler. */
+    private final JdbcQueryEventHandler handler;
+
     /**
      * Constructor.
      *
      * @param igniteTables Ignite tables API entry point.
+     * @param processor Sql query processor.
      */
-    public ClientInboundMessageHandler(IgniteTables igniteTables) {
+    public ClientInboundMessageHandler(IgniteTables igniteTables,
+        QueryProcessor processor) {
         assert igniteTables != null;
 
         this.igniteTables = igniteTables;
+
+        this.handler = new JdbcQueryEventHandlerImpl(processor);
     }
 
     /** {@inheritDoc} */
@@ -326,6 +339,18 @@ public class ClientInboundMessageHandler extends ChannelInboundHandlerAdapter {
             case ClientOp.TUPLE_CONTAINS_KEY:
                 return ClientTupleContainsKeyRequest.process(in, out, igniteTables);
 
+            case ClientOp.SQL_EXEC:
+                return ClientSqlExecuteRequest.execute(in, out, handler);
+
+            case ClientOp.SQL_EXEC_BATCH:
+                return ClientSqlExecuteBatchRequest.process(in, out, handler);
+
+            case ClientOp.SQL_NEXT:
+                return ClientSqlFetchRequest.process(in, out, handler);
+
+            case ClientOp.SQL_CURSOR_CLOSE:
+                return ClientSqlCloseRequest.process(in, out, handler);
+
             default:
                 throw new IgniteException("Unexpected operation code: " + opCode);
         }
diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java
new file mode 100644
index 0000000..782d385
--- /dev/null
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/JdbcQueryEventHandlerImpl.java
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.handler;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.event.BatchExecuteRequest;
+import org.apache.ignite.client.proto.query.event.BatchExecuteResult;
+import org.apache.ignite.client.proto.query.event.QueryCloseRequest;
+import org.apache.ignite.client.proto.query.event.QueryCloseResult;
+import org.apache.ignite.client.proto.query.event.QueryExecuteRequest;
+import org.apache.ignite.client.proto.query.event.QueryExecuteResult;
+import org.apache.ignite.client.proto.query.event.QueryFetchRequest;
+import org.apache.ignite.client.proto.query.event.QueryFetchResult;
+import org.apache.ignite.client.proto.query.event.QuerySingleResult;
+import org.apache.ignite.client.proto.query.event.Response;
+import org.apache.ignite.internal.processors.query.calcite.QueryProcessor;
+import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
+import org.apache.ignite.internal.util.Cursor;
+
+import static org.apache.ignite.client.proto.query.IgniteQueryErrorCode.UNSUPPORTED_OPERATION;
+
+/**
+ * Jdbc query event handler implementation.
+ */
+public class JdbcQueryEventHandlerImpl implements JdbcQueryEventHandler {
+    /** Current JDBC cursors. */
+    private final ConcurrentHashMap<Long, SqlCursor<List<?>>> openCursors = new ConcurrentHashMap<>();
+
+    /** Cursor Id generator. */
+    private final AtomicLong CURSOR_ID_GENERATOR = new AtomicLong();
+
+    /** Sql query processor. */
+    private final QueryProcessor processor;
+
+    /**
+     * Constructor.
+     *
+     * @param processor Processor.
+     */
+    public JdbcQueryEventHandlerImpl(QueryProcessor processor) {
+        this.processor = processor;
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryExecuteResult query(QueryExecuteRequest req) {
+        if (req.pageSize() <= 0)
+            return new QueryExecuteResult(Response.STATUS_FAILED,
+                "Invalid fetch size : [fetchSize=" + req.pageSize() + ']');
+
+        List<SqlCursor<List<?>>> cursors;
+        try {
+            cursors = processor.query(req.schemaName(), req.sqlQuery(), req.arguments() == null ? new Object[0] : req.arguments());
+        } catch (Exception e) {
+            StringWriter sw = getWriterWithStackTrace(e);
+
+            return new QueryExecuteResult(Response.STATUS_FAILED,
+                "Exception while executing query " + req.sqlQuery() + ". Error message: " + sw);
+        }
+
+        if (cursors.isEmpty())
+            return new QueryExecuteResult(Response.STATUS_FAILED,
+                "At least one cursor is expected for query " + req.sqlQuery());
+
+        List<QuerySingleResult> results = new ArrayList<>();
+
+        try {
+            for (SqlCursor<List<?>> cur : cursors) {
+                QuerySingleResult res = createJdbcResult(cur, req);
+                results.add(res);
+            }
+        } catch (Exception ex) {
+            StringWriter sw = getWriterWithStackTrace(ex);
+
+            return new QueryExecuteResult(Response.STATUS_FAILED,
+                "Failed to fetch results for query " + req.sqlQuery() + ". Error message: " + sw);
+        }
+
+        return new QueryExecuteResult(results);
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryFetchResult fetch(QueryFetchRequest req) {
+        Cursor<List<?>> cur = openCursors.get(req.cursorId());
+
+        if (cur == null)
+            return new QueryFetchResult(Response.STATUS_FAILED,
+                "Failed to find query cursor with ID: " + req.cursorId());
+
+        if (req.pageSize() <= 0)
+            return new QueryFetchResult(Response.STATUS_FAILED,
+                "Invalid fetch size : [fetchSize=" + req.pageSize() + ']');
+
+        List<List<Object>> fetch;
+        boolean hasNext;
+
+        try {
+            fetch = fetchNext(req.pageSize(), cur);
+            hasNext = cur.hasNext();
+        } catch (Exception ex) {
+            StringWriter sw = getWriterWithStackTrace(ex);
+
+            return new QueryFetchResult(Response.STATUS_FAILED,
+                "Failed to fetch results for cursor id " + req.cursorId() + ". Error message: " + sw);
+        }
+
+        return new QueryFetchResult(fetch, hasNext);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BatchExecuteResult batch(BatchExecuteRequest req) {
+        return new BatchExecuteResult(UNSUPPORTED_OPERATION,
+            "ExecuteBatch operation is not implemented yet.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryCloseResult close(QueryCloseRequest req) {
+        Cursor<List<?>> cur = openCursors.remove(req.cursorId());
+
+        if (cur == null)
+            return new QueryCloseResult(Response.STATUS_FAILED,
+                "Failed to find query cursor with ID: " + req.cursorId());
+
+        try {
+            cur.close();
+        }
+        catch (Exception ex) {
+            StringWriter sw = getWriterWithStackTrace(ex);
+
+            return new QueryCloseResult(Response.STATUS_FAILED,
+                "Failed to close SQL query [curId=" + req.cursorId() + "]. Error message: " + sw);
+        }
+
+        return new QueryCloseResult();
+    }
+
+    /**
+     * Serializes the stack trace of given exception for further sending to the client.
+     *
+     * @param ex Exception.
+     * @return StringWriter filled with exception.
+     */
+    private StringWriter getWriterWithStackTrace(Exception ex) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+
+        ex.printStackTrace(pw);
+        return sw;
+    }
+
+    /**
+     * Creates jdbc result for the cursor.
+     *
+     * @param cur Sql cursor for query.
+     * @param req Execution request.
+     * @return JdbcQuerySingleResult filled with first batch of data.
+     */
+    private QuerySingleResult createJdbcResult(SqlCursor<List<?>> cur, QueryExecuteRequest req) {
+        long cursorId = CURSOR_ID_GENERATOR.getAndIncrement();
+
+        openCursors.put(cursorId, cur);
+
+        List<List<Object>> fetch = fetchNext(req.pageSize(), cur);
+        boolean hasNext = cur.hasNext();
+
+        switch (cur.getQueryType()) {
+            case EXPLAIN:
+            case QUERY:
+                return new QuerySingleResult(cursorId, fetch, !hasNext);
+            case DML:
+            case DDL: {
+                if (!validateDmlResult(fetch, hasNext))
+                    return new QuerySingleResult(Response.STATUS_FAILED,
+                        "Unexpected result for DML query [" + req.sqlQuery() + "].");
+
+                return new QuerySingleResult(cursorId, (Long)fetch.get(0).get(0));
+            }
+            default:
+                return new QuerySingleResult(UNSUPPORTED_OPERATION,
+                    "Query type [" + cur.getQueryType() + "] is not supported yet.");
+        }
+    }
+
+    /**
+     * Validate dml result. Check if it stores only one value of Long type.
+     *
+     * @param fetch Fetched data from cursor.
+     * @param next HasNext flag.
+     * @return Boolean value indicates if data is valid or not.
+     */
+    private boolean validateDmlResult(List<List<Object>> fetch, boolean next) {
+        if (next)
+            return false;
+
+        if (fetch.size() != 1)
+            return false;
+
+        if (fetch.get(0).size() != 1)
+            return false;
+
+        return fetch.get(0).get(0) instanceof Long;
+    }
+
+    /**
+     * Fetch next batch of data.
+     *
+     * @param size Batch size.
+     * @param cursor Sql cursor.
+     * @return Array of given size with data.
+     */
+    private List<List<Object>> fetchNext(int size, Cursor<List<?>> cursor) {
+        List<List<Object>> fetch = new ArrayList<>(size);
+        for (int i = 0; i < size; i++) {
+            if (cursor.hasNext())
+                fetch.add((List<Object>)cursor.next());
+        }
+        return fetch;
+    }
+}
diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlCloseRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlCloseRequest.java
new file mode 100644
index 0000000..e04e447
--- /dev/null
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlCloseRequest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.handler.requests.sql;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.event.QueryCloseRequest;
+import org.apache.ignite.client.proto.query.event.QueryCloseResult;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+
+/**
+ * Client sql close request handler.
+ */
+public class ClientSqlCloseRequest {
+    /**
+     * Processes remote {@code JdbcQueryCloseRequest}.
+     *
+     * @param in Client message unpacker.
+     * @param out Client message packer.
+     * @param handler Query event handler.
+     * @return null value indicates synchronous operation.
+     */
+    public static CompletableFuture<Void> process(
+        ClientMessageUnpacker in,
+        ClientMessagePacker out,
+        JdbcQueryEventHandler handler
+    ) {
+        var req = new QueryCloseRequest();
+
+        req.readBinary(in);
+
+        QueryCloseResult res = handler.close(req);
+
+        res.writeBinary(out);
+
+        return null;
+    }
+}
diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteBatchRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteBatchRequest.java
new file mode 100644
index 0000000..368e099
--- /dev/null
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteBatchRequest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.handler.requests.sql;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.event.BatchExecuteRequest;
+import org.apache.ignite.client.proto.query.event.BatchExecuteResult;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+
+/**
+ * Client sql request handler.
+ */
+public class ClientSqlExecuteBatchRequest {
+    /**
+     * Processes remote {@code JdbcBatchExecuteRequest}.
+     *
+     * @param in Client message unpacker.
+     * @param out Client message packer.
+     * @param handler Query event handler.
+     * @return null value indicates synchronous operation.
+     */
+    public static CompletableFuture<Void> process(
+        ClientMessageUnpacker in,
+        ClientMessagePacker out,
+        JdbcQueryEventHandler handler
+    ) {
+        var req = new BatchExecuteRequest();
+
+        req.readBinary(in);
+
+        BatchExecuteResult res = handler.batch(req);
+
+        res.writeBinary(out);
+
+        return null;
+    }
+}
diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java
new file mode 100644
index 0000000..ed31c6b
--- /dev/null
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlExecuteRequest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.handler.requests.sql;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.event.QueryExecuteRequest;
+import org.apache.ignite.client.proto.query.event.QueryExecuteResult;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+
+/**
+ * Client sql request handler.
+ */
+public class ClientSqlExecuteRequest {
+    /**
+     * Processes remote {@code JdbcQueryExecuteRequest}.
+     *
+     * @param in Client message unpacker.
+     * @param out Client message packer.
+     * @param handler Query event handler.
+     * @return null value indicates synchronous operation.
+     */
+    public static CompletableFuture<Void> execute(
+            ClientMessageUnpacker in,
+            ClientMessagePacker out,
+            JdbcQueryEventHandler handler
+    ) {
+        var req = new QueryExecuteRequest();
+
+        req.readBinary(in);
+
+        QueryExecuteResult res = handler.query(req);
+
+        res.writeBinary(out);
+
+        return null;
+    }
+}
diff --git a/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlFetchRequest.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlFetchRequest.java
new file mode 100644
index 0000000..d40caa5
--- /dev/null
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/ClientSqlFetchRequest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.handler.requests.sql;
+
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.event.QueryFetchRequest;
+import org.apache.ignite.client.proto.query.event.QueryFetchResult;
+import org.apache.ignite.internal.client.proto.ClientMessagePacker;
+import org.apache.ignite.internal.client.proto.ClientMessageUnpacker;
+
+/**
+ * Client sql request handler.
+ */
+public class ClientSqlFetchRequest {
+    /**
+     * Processes remote {@code JdbcQueryFetchRequest}.
+     *
+     * @param in Client message unpacker.
+     * @param out Client message packer.
+     * @param handler Query event handler.
+     * @return null value indicates synchronous operation.
+     */
+    public static CompletableFuture<Void> process(
+        ClientMessageUnpacker in,
+        ClientMessagePacker out,
+        JdbcQueryEventHandler handler
+    ) {
+        var req = new QueryFetchRequest();
+
+        req.readBinary(in);
+
+        QueryFetchResult res = handler.fetch(req);
+
+        res.writeBinary(out);
+
+        return null;
+    }
+}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/package-info.java
similarity index 57%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/package-info.java
index d98fa19..1ab76f9 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client-handler/src/main/java/org/apache/ignite/client/handler/requests/sql/package-info.java
@@ -15,31 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
-
 /**
- *
+ * Sql API handler.
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
-
-    /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
-     */
-    void cancelQuery(UUID queryId);
-}
+package org.apache.ignite.client.handler.requests.sql;
diff --git a/modules/client/pom.xml b/modules/client/pom.xml
index a73a28d..22bb34e 100644
--- a/modules/client/pom.xml
+++ b/modules/client/pom.xml
@@ -118,6 +118,12 @@
             <scope>test</scope>
             <type>test-jar</type>
         </dependency>
+
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java b/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java
index b9e586a..88680be 100644
--- a/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java
+++ b/modules/client/src/main/java/org/apache/ignite/internal/client/TcpIgniteClient.java
@@ -23,6 +23,7 @@ import java.util.function.BiFunction;
 import org.apache.ignite.client.IgniteClient;
 import org.apache.ignite.client.IgniteClientConfiguration;
 import org.apache.ignite.client.IgniteClientException;
+import org.apache.ignite.client.proto.query.ClientMessage;
 import org.apache.ignite.internal.client.io.ClientConnectionMultiplexer;
 import org.apache.ignite.internal.client.table.ClientTables;
 import org.apache.ignite.table.manager.IgniteTables;
@@ -114,4 +115,18 @@ public class TcpIgniteClient implements IgniteClient {
     @Override public IgniteClientConfiguration configuration() {
         return cfg;
     }
+
+    /**
+     * Send JdbcClientMessage request to server size and reads JdbcClientMessage result.
+     *
+     * @param opCode Operation code.
+     * @param req JdbcClientMessage request.
+     * @param res JdbcClientMessage result.
+     */
+    public void sendRequest(int opCode, ClientMessage req, ClientMessage res) {
+        ch.serviceAsync(opCode, w -> req.writeBinary(w.out()), p -> {
+            res.readBinary(p.in());
+            return res;
+        }).join();
+    }
 }
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/client/query/JdbcClientQueryEventHandler.java b/modules/client/src/main/java/org/apache/ignite/internal/client/query/JdbcClientQueryEventHandler.java
new file mode 100644
index 0000000..a02b766
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/internal/client/query/JdbcClientQueryEventHandler.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.client.query;
+
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.event.BatchExecuteRequest;
+import org.apache.ignite.client.proto.query.event.BatchExecuteResult;
+import org.apache.ignite.client.proto.query.event.QueryCloseRequest;
+import org.apache.ignite.client.proto.query.event.QueryCloseResult;
+import org.apache.ignite.client.proto.query.event.QueryExecuteRequest;
+import org.apache.ignite.client.proto.query.event.QueryExecuteResult;
+import org.apache.ignite.client.proto.query.event.QueryFetchRequest;
+import org.apache.ignite.client.proto.query.event.QueryFetchResult;
+import org.apache.ignite.internal.client.TcpIgniteClient;
+import org.apache.ignite.internal.client.proto.ClientOp;
+
+/**
+ *  Jdbc query network event handler implementation.
+ */
+public class JdbcClientQueryEventHandler implements JdbcQueryEventHandler {
+    /** Channel. */
+    private final TcpIgniteClient client;
+
+    /**
+     * @param client TcpIgniteClient.
+     */
+    public JdbcClientQueryEventHandler(TcpIgniteClient client) {
+        this.client = client;
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryExecuteResult query(QueryExecuteRequest req) {
+        QueryExecuteResult res = new QueryExecuteResult();
+
+        client.sendRequest(ClientOp.SQL_EXEC, req, res);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryFetchResult fetch(QueryFetchRequest req) {
+        QueryFetchResult res = new QueryFetchResult();
+
+        client.sendRequest(ClientOp.SQL_NEXT, req, res);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public BatchExecuteResult batch(BatchExecuteRequest req) {
+        BatchExecuteResult res = new BatchExecuteResult();
+
+        client.sendRequest(ClientOp.SQL_EXEC_BATCH, req, res);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryCloseResult close(QueryCloseRequest req) {
+        QueryCloseResult res = new QueryCloseResult();
+
+        client.sendRequest(ClientOp.SQL_CURSOR_CLOSE, req, res);
+
+        return res;
+    }
+}
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/jdbc/ConnectionProperties.java b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/ConnectionProperties.java
new file mode 100644
index 0000000..385715c
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/ConnectionProperties.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc;
+
+import java.sql.SQLException;
+import org.apache.ignite.internal.client.HostAndPortRange;
+
+/**
+ * Provide access and manipulations with connection JDBC properties.
+ */
+public interface ConnectionProperties {
+    /**
+     * Get the schema name.
+     *
+     * @return Schema name of the connection.
+     */
+    String getSchema();
+
+    /**
+     * Set the schema name.
+     *
+     * @param schema Schema name of the connection.
+     */
+    void setSchema(String schema);
+
+    /**
+     * Get the URL.
+     *
+     * @return The URL of the connection.
+     */
+    String getUrl();
+
+    /**
+     * Set the URL.
+     *
+     * @param url The URL of the connection.
+     * @throws SQLException On invalid URL.
+     */
+    void setUrl(String url) throws SQLException;
+
+    /**
+     * Get the addresses.
+     *
+     * @return Ignite nodes addresses.
+     */
+    HostAndPortRange[] getAddresses();
+
+    /**
+     * Set the ignite node addresses.
+     *
+     * @param addrs Ignite nodes addresses.
+     */
+    void setAddresses(HostAndPortRange[] addrs);
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @return Query timeout in seconds.
+     */
+    Integer getQueryTimeout();
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @param qryTimeout Query timeout in seconds.
+     * @throws SQLException On error.
+     */
+    void setQueryTimeout(Integer qryTimeout) throws SQLException;
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @return Retry limit.
+     */
+    Integer getRetryLimit();
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @param retryLimit Connection retry limit.
+     * @throws SQLException On error.
+     */
+    void setRetryLimit(Integer retryLimit) throws SQLException;
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @return Reconnect throttling period.
+     */
+    Long getReconnectThrottlingPeriod();
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @param reconnectThrottlingPeriod Reconnect throttling period.
+     * @throws SQLException On error.
+     */
+    void setReconnectThrottlingPeriod(Long reconnectThrottlingPeriod) throws SQLException;
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @return Reconnect throttling retries.
+     */
+    Integer getReconnectThrottlingRetries();
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @param ReconnectThrottlingRetries Reconnect throttling retries.
+     * @throws SQLException On error.
+     */
+    void setReconnectThrottlingRetries(Integer ReconnectThrottlingRetries) throws SQLException;
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @return Connection timeout in milliseconds.
+     */
+    int getConnectionTimeout();
+
+    /**
+     * Note: zero value means there is no limits.
+     *
+     * @param connTimeout Connection timeout in milliseconds.
+     * @throws SQLException On error.
+     */
+    void setConnectionTimeout(Integer connTimeout) throws SQLException;
+}
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/jdbc/ConnectionPropertiesImpl.java b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/ConnectionPropertiesImpl.java
new file mode 100644
index 0000000..2290ba7
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/ConnectionPropertiesImpl.java
@@ -0,0 +1,843 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc;
+
+import java.io.Serializable;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import org.apache.ignite.client.IgniteClientConfiguration;
+import org.apache.ignite.client.proto.query.SqlStateCode;
+import org.apache.ignite.internal.client.HostAndPortRange;
+import org.apache.ignite.internal.util.ArrayUtils;
+import org.apache.ignite.lang.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Holds JDBC connection properties.
+ */
+public class ConnectionPropertiesImpl implements ConnectionProperties, Serializable {
+    /** URL prefix. */
+    public static final String URL_PREFIX = "jdbc:ignite:thin://";
+
+    /** Serial version UID. */
+    private static final long serialVersionUID = 0L;
+
+    /** Prefix for property names. */
+    public static final String PROP_PREFIX = "ignite.jdbc.";
+
+    /** Property: schema. */
+    private static final String PROP_SCHEMA = "schema";
+
+    /** Connection URL. */
+    private String url;
+
+    /** Addresses. */
+    private HostAndPortRange[] addrs;
+
+    /** Schema name. Hidden property. Is used to set default schema name part of the URL. */
+    private final StringProperty schema = new StringProperty(PROP_SCHEMA,
+        "Schema name of the connection", "PUBLIC", null, false, null);
+
+    /** Query timeout. */
+    private final IntegerProperty qryTimeout = new IntegerProperty("queryTimeout",
+        "Sets the number of seconds the driver will wait for a <code>Statement</code> object to execute." +
+            " Zero means there is no limits.",
+        null, false, 0, Integer.MAX_VALUE);
+
+    /** JDBC connection timeout. */
+    private final IntegerProperty connTimeout = new IntegerProperty("connectionTimeout",
+        "Sets the number of milliseconds JDBC client will waits for server to response." +
+            " Zero means there is no limits.",
+        0L, false, 0, Integer.MAX_VALUE);
+
+    /** JDBC retry limit. */
+    private final IntegerProperty retryLimit = new IntegerProperty("retryLimit",
+        "Sets the retry limit. When a request fails due to a connection error, and multiple server connections " +
+            "are available, Ignite will retry the request on every connection. When this property is greater than " +
+            "zero, Ignite will limit the number of retries.",
+        IgniteClientConfiguration.DFLT_RETRY_LIMIT, false, 0, Integer.MAX_VALUE);
+
+    /** JDBC reconnect throttling period. */
+    private final LongProperty reconnectThrottlingPeriod = new LongProperty("reconnectThrottlingPeriod",
+        "Sets the reconnect throttling period, in milliseconds." +
+            " Zero means there is no limits.",
+        IgniteClientConfiguration.DFLT_RECONNECT_THROTTLING_PERIOD, false, 0, Long.MAX_VALUE);
+
+    /** JDBC reconnect throttling retries. */
+    private final IntegerProperty reconnectThrottlingRetries = new IntegerProperty("reconnectThrottlingRetries",
+        "Sets the reconnect throttling retries." +
+            " Zero means there is no limits.",
+        IgniteClientConfiguration.DFLT_RECONNECT_THROTTLING_RETRIES, false, 0, Integer.MAX_VALUE);
+
+    /** Properties array. */
+    private final ConnectionProperty[] propsArray = {qryTimeout, connTimeout};
+
+    /** {@inheritDoc} */
+    @Override public String getSchema() {
+        return schema.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setSchema(String schema) {
+        this.schema.setValue(schema);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getUrl() {
+        if (url != null)
+            return url;
+        else {
+            if (ArrayUtils.nullOrEmpty(getAddresses()))
+                return null;
+
+            StringBuilder sbUrl = new StringBuilder(URL_PREFIX);
+
+            HostAndPortRange[] addrs = getAddresses();
+
+            for (int i = 0; i < addrs.length; i++) {
+                if (i > 0)
+                    sbUrl.append(',');
+
+                sbUrl.append(addrs[i].toString());
+            }
+
+            if (!isEmpty(getSchema()))
+                sbUrl.append('/').append(getSchema());
+
+            return sbUrl.toString();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setUrl(String url) throws SQLException {
+        this.url = url;
+
+        init(url, new Properties());
+    }
+
+    /** {@inheritDoc} */
+    @Override public HostAndPortRange[] getAddresses() {
+        return addrs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAddresses(HostAndPortRange[] addrs) {
+        this.addrs = addrs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Integer getQueryTimeout() {
+        return qryTimeout.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setQueryTimeout(@Nullable Integer timeout) throws SQLException {
+        qryTimeout.setValue(timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Integer getRetryLimit() {
+        return retryLimit.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setRetryLimit(Integer limit) throws SQLException {
+        retryLimit.setValue(limit);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Long getReconnectThrottlingPeriod() {
+        return reconnectThrottlingPeriod.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setReconnectThrottlingPeriod(Long period) throws SQLException {
+        reconnectThrottlingPeriod.setValue(period);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Integer getReconnectThrottlingRetries() {
+        return reconnectThrottlingRetries.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setReconnectThrottlingRetries(Integer retries) throws SQLException {
+        reconnectThrottlingRetries.setValue(retries);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getConnectionTimeout() {
+        return connTimeout.value();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setConnectionTimeout(@Nullable Integer timeout) throws SQLException {
+        connTimeout.setValue(timeout);
+    }
+
+    /**
+     * Init connection properties.
+     *
+     * @param url URL connection.
+     * @param props Environment properties.
+     * @throws SQLException On error.
+     */
+    public void init(String url, Properties props) throws SQLException {
+        assert props != null;
+        Properties props0 = (Properties)props.clone();
+
+        if (!isEmpty(url))
+            parseUrl(url, props0);
+
+        for (ConnectionProperty aPropsArray : propsArray)
+            aPropsArray.init(props0);
+    }
+
+    /**
+     * Validates and parses connection URL.
+     *
+     * @param url URL.
+     * @param props Properties.
+     * @throws SQLException On error.
+     */
+    private void parseUrl(String url, Properties props) throws SQLException {
+        if (isEmpty(url))
+            throw new SQLException("URL cannot be null or empty.");
+
+        if (!url.startsWith(URL_PREFIX))
+            throw new SQLException("URL must start with \"" + URL_PREFIX + "\"");
+
+        String nakedUrl = url.substring(URL_PREFIX.length()).trim();
+
+        parseUrl0(nakedUrl, props);
+    }
+
+    /**
+     * Parse naked URL (i.e. without {@link ConnectionPropertiesImpl#URL_PREFIX}).
+     *
+     * @param url Naked URL.
+     * @param props Properties.
+     * @throws SQLException If failed.
+     */
+    private void parseUrl0(String url, Properties props) throws SQLException {
+        // Determine mode - semicolon or ampersand.
+        int semicolonPos = url.indexOf(";");
+        int slashPos = url.indexOf("/");
+        int queryPos = url.indexOf("?");
+
+        boolean semicolonMode;
+
+        if (semicolonPos == -1 && slashPos == -1 && queryPos == -1)
+            // No special char -> any mode could be used, choose semicolon for simplicity.
+            semicolonMode = true;
+        else {
+            if (semicolonPos != -1) {
+                // Use semicolon mode if it appears earlier than slash or query.
+                semicolonMode =
+                    (slashPos == -1 || semicolonPos < slashPos) && (queryPos == -1 || semicolonPos < queryPos);
+            }
+            else
+                // Semicolon is not found.
+                semicolonMode = false;
+        }
+
+        if (semicolonMode)
+            parseUrlWithSemicolon(url, props);
+        else
+            parseUrlWithQuery(url, props);
+    }
+
+    /**
+     * Parse URL in semicolon mode.
+     *
+     * @param url Naked URL
+     * @param props Properties.
+     * @throws SQLException If failed.
+     */
+    private void parseUrlWithSemicolon(String url, Properties props) throws SQLException {
+        int pathPartEndPos = url.indexOf(';');
+
+        if (pathPartEndPos == -1)
+            pathPartEndPos = url.length();
+
+        String pathPart = url.substring(0, pathPartEndPos);
+
+        String paramPart = null;
+
+        if (pathPartEndPos > 0 && pathPartEndPos < url.length())
+            paramPart = url.substring(pathPartEndPos + 1);
+
+        parseEndpoints(pathPart);
+
+        if (!isEmpty(paramPart))
+            parseParameters(paramPart, props, ";");
+    }
+
+    /**
+     * Parse URL in query mode.
+     *
+     * @param url Naked URL
+     * @param props Properties.
+     * @throws SQLException If failed.
+     */
+    private void parseUrlWithQuery(String url, Properties props) throws SQLException {
+        int pathPartEndPos = url.indexOf('?');
+
+        if (pathPartEndPos == -1)
+            pathPartEndPos = url.length();
+
+        String pathPart = url.substring(0, pathPartEndPos);
+
+        String paramPart = null;
+
+        if (pathPartEndPos > 0 && pathPartEndPos < url.length())
+            paramPart = url.substring(pathPartEndPos + 1);
+
+        String[] pathParts = pathPart.split("/");
+
+        parseEndpoints(pathParts[0]);
+
+        if (pathParts.length > 2) {
+            throw new SQLException("Invalid URL format (only schema name is allowed in URL path parameter " +
+                "'host:port[/schemaName]'): " + this.url, SqlStateCode.CLIENT_CONNECTION_FAILED);
+        }
+
+        setSchema(pathParts.length == 2 ? pathParts[1] : null);
+
+        if (!isEmpty(paramPart))
+            parseParameters(paramPart, props, "&");
+    }
+
+    /**
+     * Parse endpoints.
+     *
+     * @param endpointStr Endpoint string.
+     * @throws SQLException If failed.
+     */
+    private void parseEndpoints(String endpointStr) throws SQLException {
+        String[] endpoints = endpointStr.split(",");
+
+        if (endpoints.length > 0)
+            addrs = new HostAndPortRange[endpoints.length];
+
+        for (int i = 0; i < endpoints.length; ++i ) {
+            try {
+                addrs[i] = HostAndPortRange.parse(endpoints[i],
+                    IgniteClientConfiguration.DFLT_PORT, IgniteClientConfiguration.DFLT_PORT,
+                    "Invalid endpoint format (should be \"host[:portRangeFrom[..portRangeTo]]\")");
+            }
+            catch (IgniteException e) {
+                throw new SQLException(e.getMessage(), SqlStateCode.CLIENT_CONNECTION_FAILED, e);
+            }
+        }
+
+        if (addrs == null || addrs.length == 0 || addrs[0].host() == null || addrs[0].host().isEmpty())
+            throw new SQLException("Host name is empty", SqlStateCode.CLIENT_CONNECTION_FAILED);
+    }
+
+    /**
+     * Validates and parses URL parameters.
+     *
+     * @param paramStr Parameters string.
+     * @param props Properties.
+     * @param delimChar Delimiter character.
+     * @throws SQLException If failed.
+     */
+    private void parseParameters(String paramStr, Properties props, String delimChar) throws SQLException {
+        StringTokenizer st = new StringTokenizer(paramStr, delimChar);
+
+        boolean insideBrace = false;
+
+        String key = null;
+        String val = null;
+
+        while (st.hasMoreTokens()) {
+            String token = st.nextToken();
+
+            if (!insideBrace) {
+                int eqSymPos = token.indexOf('=');
+
+                if (eqSymPos < 0) {
+                    throw new SQLException("Invalid parameter format (should be \"key1=val1" + delimChar +
+                        "key2=val2" + delimChar + "...\"): " + token);
+                }
+
+                if (eqSymPos == token.length())
+                    throw new SQLException("Invalid parameter format (key and value cannot be empty): " + token);
+
+                key = token.substring(0, eqSymPos);
+                val = token.substring(eqSymPos + 1);
+
+                if (val.startsWith("{")) {
+                    val = val.substring(1);
+
+                    insideBrace = true;
+                }
+            }
+            else
+                val += delimChar + token;
+
+            if (val.endsWith("}")) {
+                insideBrace = false;
+
+                val = val.substring(0, val.length() - 1);
+            }
+
+            if (val.contains("{") || val.contains("}")) {
+                throw new SQLException("Braces cannot be escaped in the value. " +
+                    "Please use the connection Properties for such values. [property=" + key + ']');
+            }
+
+            if (!insideBrace) {
+                if (key.isEmpty() || val.isEmpty())
+                    throw new SQLException("Invalid parameter format (key and value cannot be empty): " + token);
+
+                if (PROP_SCHEMA.equalsIgnoreCase(key))
+                    setSchema(val);
+                else
+                    props.setProperty(PROP_PREFIX + key, val);
+            }
+        }
+    }
+
+    /**
+     * Property validator interface.
+     */
+    private interface PropertyValidator extends Serializable {
+        /**
+         * Validate property.
+         *
+         * @param val String representation of the property value to validate.
+         * @throws SQLException On validation fails.
+         */
+        void validate(String val) throws SQLException;
+    }
+
+    /**
+     * Connection property.
+     */
+    private abstract static class ConnectionProperty implements Serializable {
+        /** Serial version UID. */
+        private static final long serialVersionUID = 0L;
+
+        /** Name. */
+        protected String name;
+
+        /** Property description. */
+        protected String desc;
+
+        /** Default value. */
+        protected Object dfltVal;
+
+        /**
+         * An array of possible values if the value may be selected
+         * from a particular set of values; otherwise null.
+         */
+        protected String[] choices;
+
+        /** Required flag. */
+        protected boolean required;
+
+        /** Property validator. */
+        protected PropertyValidator validator;
+
+        /**
+         * Constructor.
+         *
+         * @param name Name.
+         * @param desc Description.
+         * @param dfltVal Default value.
+         * @param choices Possible values.
+         * @param required {@code true} if the property is required.
+         */
+        ConnectionProperty(String name, String desc, Object dfltVal, String[] choices, boolean required) {
+            this.name = name;
+            this.desc = desc;
+            this.dfltVal = dfltVal;
+            this.choices = choices;
+            this.required = required;
+        }
+
+        /**
+         * Constructor.
+         *
+         * @param name Name.
+         * @param desc Description.
+         * @param dfltVal Default value.
+         * @param choices Possible values.
+         * @param required {@code true} if the property is required.
+         * @param validator Property validator.
+         */
+        ConnectionProperty(String name, String desc, Object dfltVal, String[] choices, boolean required,
+            PropertyValidator validator) {
+            this.name = name;
+            this.desc = desc;
+            this.dfltVal = dfltVal;
+            this.choices = choices;
+            this.required = required;
+            this.validator = validator;
+        }
+
+        /**
+         * Get the default value.
+         *
+         * @return Default value.
+         */
+        Object getDfltVal() {
+            return dfltVal;
+        }
+
+        /**
+         * Get the property name.
+         *
+         * @return Property name.
+         */
+        String getName() {
+            return name;
+        }
+
+        /**
+         * Get the array of possible values.
+         *
+         * @return Array of possible values if the value may be selected
+         * from a particular set of values; otherwise null
+         */
+        String[] choices() {
+            return choices;
+        }
+
+        /**
+         * Init properties.
+         *
+         * @param props Properties.
+         * @throws SQLException On error.
+         */
+        void init(Properties props) throws SQLException {
+            String strVal = props.getProperty(PROP_PREFIX + name);
+
+            if (required && strVal == null) {
+                throw new SQLException("Property '" + name + "' is required but not defined",
+                    SqlStateCode.CLIENT_CONNECTION_FAILED);
+            }
+
+            if (validator != null)
+                validator.validate(strVal);
+
+            checkChoices(strVal);
+
+            props.remove(name);
+
+            init(strVal);
+        }
+
+        /**
+         * Check the choices.
+         *
+         * @param strVal Checked value.
+         * @throws SQLException On check error.
+         */
+        protected void checkChoices(String strVal) throws SQLException {
+            if (strVal == null)
+                return;
+
+            if (choices != null) {
+                for (String ch : choices) {
+                    if (ch.equalsIgnoreCase(strVal))
+                        return;
+                }
+
+                throw new SQLException("Invalid property value. [name=" + name + ", val=" + strVal
+                    + ", choices=" + Arrays.toString(choices) + ']', SqlStateCode.CLIENT_CONNECTION_FAILED);
+            }
+        }
+
+        /**
+         * Init property.
+         *
+         * @param str String representation of the property value.
+         * @throws SQLException on error.
+         */
+        abstract void init(String str) throws SQLException;
+
+        /**
+         * Get the string representation of the property value.
+         *
+         * @return String representation of the property value.
+         */
+        abstract String valueObject();
+
+        /**
+         * Get the driver property info.
+         *
+         * @return JDBC property info object.
+         */
+        DriverPropertyInfo getDriverPropertyInfo() {
+            DriverPropertyInfo dpi = new DriverPropertyInfo(PROP_PREFIX + name, valueObject());
+
+            dpi.choices = choices();
+            dpi.required = required;
+            dpi.description = desc;
+
+            return dpi;
+        }
+    }
+
+    /**
+     * Number property.
+     */
+    private abstract static class NumberProperty extends ConnectionProperty {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /** Value. */
+        protected Number val;
+
+        /** Allowed value range. */
+        private Number[] range;
+
+        /**
+         * Constructor.
+         *
+         * @param name Name.
+         * @param desc Description.
+         * @param dfltVal Default value.
+         * @param required {@code true} if the property is required.
+         * @param min Lower bound of allowed range.
+         * @param max Upper bound of allowed range.
+         */
+        NumberProperty(String name, String desc, Number dfltVal, boolean required, Number min, Number max) {
+            super(name, desc, dfltVal, null, required);
+
+            val = dfltVal;
+
+            range = new Number[] {min, max};
+        }
+
+        /** {@inheritDoc} */
+        @Override void init(String str) throws SQLException {
+            if (str == null)
+                val = dfltVal != null ? (Number)dfltVal : null;
+            else {
+                try {
+                    setValue(parse(str));
+                }
+                catch (NumberFormatException e) {
+                    throw new SQLException("Failed to parse int property [name=" + name +
+                        ", value=" + str + ']', SqlStateCode.CLIENT_CONNECTION_FAILED);
+                }
+            }
+        }
+
+        /**
+         * Parse the property string representation.
+         *
+         * @param str String value.
+         * @return Number value.
+         * @throws NumberFormatException On parse error.
+         */
+        protected abstract Number parse(String str) throws NumberFormatException;
+
+        /** {@inheritDoc} */
+        @Override String valueObject() {
+            return val != null ? String.valueOf(val) : null;
+        }
+
+        /**
+         * Set number property value.
+         *
+         * @param val Property value.
+         * @throws SQLException On error.
+         */
+        void setValue(Number val) throws SQLException {
+            if (range != null) {
+                if (val.doubleValue() < range[0].doubleValue()) {
+                    throw new SQLException("Property cannot be lower than " + range[0].toString() + " [name=" + name +
+                        ", value=" + val.toString() + ']', SqlStateCode.CLIENT_CONNECTION_FAILED);
+                }
+
+                if (val.doubleValue() > range[1].doubleValue()) {
+                    throw new SQLException("Property cannot be upper than " + range[1].toString() + " [name=" + name +
+                        ", value=" + val.toString() + ']', SqlStateCode.CLIENT_CONNECTION_FAILED);
+                }
+            }
+
+            this.val = val;
+        }
+    }
+
+    /**
+     * Integer property.
+     */
+    private static class IntegerProperty extends NumberProperty {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Constructor.
+         *
+         * @param name Name.
+         * @param desc Description.
+         * @param dfltVal Default value.
+         * @param required {@code true} if the property is required.
+         * @param min Lower bound of allowed range.
+         * @param max Upper bound of allowed range.
+         */
+        IntegerProperty(String name, String desc, Number dfltVal, boolean required, int min, int max) {
+            super(name, desc, dfltVal, required, min, max);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Number parse(String str) throws NumberFormatException {
+            return Integer.parseInt(str);
+        }
+
+        /**
+         * Get the property value.
+         *
+         * @return Property value.
+         */
+        Integer value() {
+            return val != null ? val.intValue() : null;
+        }
+    }
+
+    /**
+     * Long property.
+     */
+    private static class LongProperty extends NumberProperty {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /**
+         * Constructor.
+         *
+         * @param name Name.
+         * @param desc Description.
+         * @param dfltVal Default value.
+         * @param required {@code true} if the property is required.
+         * @param min Lower bound of allowed range.
+         * @param max Upper bound of allowed range.
+         */
+        LongProperty(String name, String desc, Number dfltVal, boolean required, long min, long max) {
+            super(name, desc, dfltVal, required, min, max);
+        }
+
+        /** {@inheritDoc} */
+        @Override protected Number parse(String str) throws NumberFormatException {
+            return Long.parseLong(str);
+        }
+
+        /**
+         * Get the property value.
+         *
+         * @return Property value.
+         */
+        Long value() {
+            return val != null ? val.longValue() : null;
+        }
+    }
+
+    /**
+     * String property.
+     */
+    private static class StringProperty extends ConnectionProperty {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /** Value. */
+        private String val;
+
+        /**
+         * Constructor.
+         *
+         * @param name Name.
+         * @param desc Description.
+         * @param dfltVal Default value.
+         * @param choices Possible values.
+         * @param required {@code true} if the property is required.
+         * @param validator Property value validator.
+         */
+        StringProperty(String name, String desc, String dfltVal, String[] choices, boolean required,
+            PropertyValidator validator) {
+            super(name, desc, dfltVal, choices, required, validator);
+
+            val = dfltVal;
+        }
+
+        /**
+         * Set the property value.
+         *
+         * @param val Property value.
+         */
+        void setValue(String val) {
+            this.val = val;
+        }
+
+        /**
+         * Get the property value.
+         *
+         * @return Property value.
+         */
+        String value() {
+            return val;
+        }
+
+        /** {@inheritDoc} */
+        @Override void init(String str) throws SQLException {
+            if (validator != null)
+                validator.validate(str);
+
+            if (str == null)
+                val = (String)dfltVal;
+            else
+                val = str;
+        }
+
+        /** {@inheritDoc} */
+        @Override String valueObject() {
+            return val;
+        }
+    }
+
+    /**
+     * Get the driver properties.
+     *
+     * @return Driver's properties info array.
+     */
+    public DriverPropertyInfo[] getDriverPropertyInfo() {
+        DriverPropertyInfo[] infos = new DriverPropertyInfo[propsArray.length];
+
+        for (int i = 0; i < propsArray.length; ++i)
+            infos[i] = propsArray[i].getDriverPropertyInfo();
+
+        return infos;
+    }
+
+    /**
+     * Check if this string is null, empty or blank line.
+     *
+     * @param str Examined string.
+     * @return {@code True} if this string is null, empty or blank line.
+     */
+    private static boolean isEmpty(String str) {
+        return str == null || str.isEmpty() || str.isBlank();
+    }
+}
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
new file mode 100644
index 0000000..f8effd4
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
@@ -0,0 +1,777 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLPermission;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.ShardingKey;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.Executor;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.SqlStateCode;
+import org.apache.ignite.internal.client.HostAndPortRange;
+import org.apache.ignite.internal.client.TcpIgniteClient;
+import org.apache.ignite.internal.client.query.JdbcClientQueryEventHandler;
+import org.apache.ignite.schema.SchemaTable;
+import org.jetbrains.annotations.Nullable;
+
+import static java.sql.ResultSet.CLOSE_CURSORS_AT_COMMIT;
+import static java.sql.ResultSet.CONCUR_READ_ONLY;
+import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
+import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
+import static org.apache.ignite.client.proto.query.SqlStateCode.CONNECTION_CLOSED;
+
+/**
+ * JDBC connection implementation.
+ */
+public class JdbcConnection implements Connection {
+    /** Network timeout permission. */
+    private static final String SET_NETWORK_TIMEOUT_PERM = "setNetworkTimeout";
+
+    /** Statements modification mutex. */
+    private final Object stmtsMux = new Object();
+
+    /** Handler. */
+    private final JdbcQueryEventHandler handler;
+
+    /** Schema name. */
+    private String schema;
+
+    /** Closed flag. */
+    private volatile boolean closed;
+
+    /** Current transaction isolation. */
+    private int txIsolation;
+
+    /** Auto-commit flag. */
+    private boolean autoCommit;
+
+    /** Read-only flag. */
+    private boolean readOnly;
+
+    /** Current transaction holdability. */
+    private int holdability;
+
+    /** Connection properties. */
+    private final ConnectionProperties connProps;
+
+    /** Tracked statements to close on disconnect. */
+    private final Set<JdbcStatement> stmts = Collections.newSetFromMap(new IdentityHashMap<>());
+
+    /** Network timeout. */
+    private int netTimeout;
+
+    /** Query timeout. */
+    private final @Nullable Integer qryTimeout;
+
+    /** Ignite remote client. */
+    private final TcpIgniteClient client;
+
+    /**
+     * Constructor.
+     *
+     * @param handler Handler.
+     * @param props Properties.
+     */
+    public JdbcConnection(JdbcQueryEventHandler handler, ConnectionProperties props) {
+        this.connProps = props;
+        this.handler = handler;
+
+        autoCommit = true;
+
+        netTimeout = connProps.getConnectionTimeout();
+        qryTimeout = connProps.getQueryTimeout();
+
+        holdability = HOLD_CURSORS_OVER_COMMIT;
+
+        schema = SchemaTable.DEFAULT_SCHEMA_NAME;
+
+        client = null;
+    }
+
+    /**
+     * Creates new connection.
+     *
+     * @param props Connection properties.
+     */
+    public JdbcConnection(ConnectionProperties props) {
+        this.connProps = props;
+        autoCommit = true;
+
+        String[] addrs = Arrays.stream(props.getAddresses()).map(this::createStrAddress)
+            .toArray(String[]::new);
+
+        netTimeout = connProps.getConnectionTimeout();
+        qryTimeout = connProps.getQueryTimeout();
+
+        int retryLimit = connProps.getRetryLimit();
+        long reconnectThrottlingPeriod = connProps.getReconnectThrottlingPeriod();
+        int reconnectThrottlingRetries = connProps.getReconnectThrottlingRetries();
+
+        client = ((TcpIgniteClient)IgniteClient
+            .builder()
+            .addresses(addrs)
+            .connectTimeout(netTimeout)
+            .retryLimit(retryLimit)
+            .reconnectThrottlingPeriod(reconnectThrottlingPeriod)
+            .reconnectThrottlingRetries(reconnectThrottlingRetries)
+            .build());
+
+        this.handler = new JdbcClientQueryEventHandler(client);
+
+        txIsolation = Connection.TRANSACTION_NONE;
+
+        schema = normalizeSchema(connProps.getSchema());
+
+        holdability = HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement createStatement() throws SQLException {
+        return createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement createStatement(int resSetType, int resSetConcurrency) throws SQLException {
+        return createStatement(resSetType, resSetConcurrency, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement createStatement(int resSetType, int resSetConcurrency,
+        int resSetHoldability) throws SQLException {
+        ensureNotClosed();
+
+        checkCursorOptions(resSetType, resSetConcurrency);
+
+        JdbcStatement stmt = new JdbcStatement(this, resSetHoldability, schema);
+
+        if (qryTimeout != null)
+            stmt.setQueryTimeout(qryTimeout);
+
+        synchronized (stmtsMux) {
+            stmts.add(stmt);
+        }
+
+        return stmt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql) throws SQLException {
+        return prepareStatement(sql, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int resSetType,
+        int resSetConcurrency) throws SQLException {
+        return prepareStatement(sql, resSetType, resSetConcurrency, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int resSetType, int resSetConcurrency,
+        int resSetHoldability) throws SQLException {
+        ensureNotClosed();
+
+        checkCursorOptions(resSetType, resSetConcurrency);
+
+        Objects.requireNonNull(sql);
+
+        JdbcPreparedStatement stmt = new JdbcPreparedStatement(this, sql, resSetHoldability, schema);
+
+        synchronized (stmtsMux) {
+            stmts.add(stmt);
+        }
+
+        return stmt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String nativeSQL(String sql) throws SQLException {
+        ensureNotClosed();
+
+        Objects.requireNonNull(sql);
+
+        return sql;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAutoCommit(boolean autoCommit) throws SQLException {
+        ensureNotClosed();
+
+        if (autoCommit != this.autoCommit) {
+            this.autoCommit = autoCommit;
+            
+            doCommit(); // Specification requires to commit current tx if 'autoCommit' state was changed.
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getAutoCommit() throws SQLException {
+        ensureNotClosed();
+
+        return autoCommit;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void commit() throws SQLException {
+        ensureNotClosed();
+
+        if (autoCommit)
+            throw new SQLException("Transaction cannot be committed explicitly in auto-commit mode.");
+
+         doCommit();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void rollback() throws SQLException {
+        ensureNotClosed();
+
+        if (autoCommit)
+            throw new SQLException("Transaction cannot be rolled back explicitly in auto-commit mode.");
+
+        try (Statement s = createStatement()) {
+            s.execute("ROLLBACK");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws SQLException {
+        if (isClosed())
+            return;
+
+        closed = true;
+
+        synchronized (stmtsMux) {
+            stmts.clear();
+        }
+
+        if (client == null)
+            return;
+
+        try {
+            client.close();
+        }
+        catch (Exception e) {
+            throw new SQLException(e);
+        }
+    }
+
+    /**
+     * Ensures that connection is not closed.
+     *
+     * @throws SQLException If connection is closed.
+     */
+    public void ensureNotClosed() throws SQLException {
+        if (closed)
+            throw new SQLException("Connection is closed.", CONNECTION_CLOSED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isClosed() throws SQLException {
+        return closed;
+    }
+
+    /** {@inheritDoc} */
+    @Override public DatabaseMetaData getMetaData() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("DatabaseMetaData is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setReadOnly(boolean readOnly) throws SQLException {
+        ensureNotClosed();
+
+        this.readOnly = readOnly;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isReadOnly() throws SQLException {
+        ensureNotClosed();
+
+        return readOnly;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCatalog(String catalog) throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getCatalog() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTransactionIsolation(int level) throws SQLException {
+        ensureNotClosed();
+
+        switch (level) {
+            case Connection.TRANSACTION_READ_UNCOMMITTED:
+            case Connection.TRANSACTION_READ_COMMITTED:
+            case Connection.TRANSACTION_REPEATABLE_READ:
+            case Connection.TRANSACTION_SERIALIZABLE:
+            case Connection.TRANSACTION_NONE:
+                break;
+
+            default:
+                throw new SQLException("Invalid transaction isolation level.", SqlStateCode.INVALID_TRANSACTION_LEVEL);
+        }
+
+        txIsolation = level;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTransactionIsolation() throws SQLException {
+        ensureNotClosed();
+
+        return txIsolation;
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLWarning getWarnings() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearWarnings() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map<String, Class<?>> getTypeMap() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Types mapping is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Types mapping is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setHoldability(int holdability) throws SQLException {
+        ensureNotClosed();
+
+        if (holdability != HOLD_CURSORS_OVER_COMMIT && holdability != CLOSE_CURSORS_AT_COMMIT)
+            throw new SQLException("Invalid result set holdability value.");
+
+        this.holdability = holdability;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getHoldability() throws SQLException {
+        ensureNotClosed();
+
+        return holdability;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Savepoint setSavepoint() throws SQLException {
+        ensureNotClosed();
+
+        if (autoCommit)
+            throw new SQLException("Savepoint cannot be set in auto-commit mode.");
+
+        throw new SQLFeatureNotSupportedException("Savepoints are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Savepoint setSavepoint(String name) throws SQLException {
+        ensureNotClosed();
+
+        if (name == null)
+            throw new SQLException("Savepoint name cannot be null.");
+
+        if (autoCommit)
+            throw new SQLException("Savepoint cannot be set in auto-commit mode.");
+
+        throw new SQLFeatureNotSupportedException("Savepoints are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void rollback(Savepoint savepoint) throws SQLException {
+        ensureNotClosed();
+
+        if (savepoint == null)
+            throw new SQLException("Invalid savepoint.");
+
+        if (autoCommit)
+            throw new SQLException("Auto-commit mode.");
+
+        throw new SQLFeatureNotSupportedException("Savepoints are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+        ensureNotClosed();
+
+        if (savepoint == null)
+            throw new SQLException("Savepoint cannot be null.");
+
+        throw new SQLFeatureNotSupportedException("Savepoints are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public CallableStatement prepareCall(String sql) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Callable functions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public CallableStatement prepareCall(String sql, int resSetType, int resSetConcurrency)
+        throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Callable functions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public CallableStatement prepareCall(String sql, int resSetType, int resSetConcurrency,
+        int resSetHoldability) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Callable functions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Auto generated keys are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int[] colIndexes) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Auto generated keys are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, String[] colNames) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Auto generated keys are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Clob createClob() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Blob createBlob() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public NClob createNClob() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLXML createSQLXML() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isValid(int timeout) throws SQLException {
+        if (timeout < 0)
+            throw new SQLException("Invalid timeout: " + timeout);
+
+        return !closed;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClientInfo(String name, String val) throws SQLClientInfoException {
+        if (closed)
+            throw new SQLClientInfoException("Connection is closed.", null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClientInfo(Properties props) throws SQLClientInfoException {
+        if (closed)
+            throw new SQLClientInfoException("Connection is closed.", null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getClientInfo(String name) throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Properties getClientInfo() throws SQLException {
+        ensureNotClosed();
+
+        return new Properties();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
+        ensureNotClosed();
+
+        if (typeName == null)
+            throw new SQLException("Type name cannot be null.");
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Struct createStruct(String typeName, Object[] attrs) throws SQLException {
+        ensureNotClosed();
+
+        if (typeName == null)
+            throw new SQLException("Type name cannot be null.");
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setSchema(String schema) throws SQLException {
+        ensureNotClosed();
+
+        this.schema = normalizeSchema(schema);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getSchema() throws SQLException {
+        ensureNotClosed();
+
+        return schema;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void abort(Executor executor) throws SQLException {
+        if (executor == null)
+            throw new SQLException("Executor cannot be null.");
+
+        close();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNetworkTimeout(Executor executor, int ms) throws SQLException {
+        ensureNotClosed();
+
+        if (ms < 0)
+            throw new SQLException("Network timeout cannot be negative.");
+
+        SecurityManager secMgr = System.getSecurityManager();
+
+        if (secMgr != null)
+            secMgr.checkPermission(new SQLPermission(SET_NETWORK_TIMEOUT_PERM));
+
+        netTimeout = ms;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getNetworkTimeout() throws SQLException {
+        ensureNotClosed();
+
+        return netTimeout;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void beginRequest() throws SQLException {
+        ensureNotClosed();
+
+        Connection.super.beginRequest();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void endRequest() throws SQLException {
+        ensureNotClosed();
+
+        Connection.super.endRequest();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean setShardingKeyIfValid(ShardingKey shardingKey, ShardingKey superShardingKey,
+        int timeout) throws SQLException {
+        ensureNotClosed();
+
+        return Connection.super.setShardingKeyIfValid(shardingKey, superShardingKey, timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout) throws SQLException {
+        ensureNotClosed();
+
+        return Connection.super.setShardingKeyIfValid(shardingKey, timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey) throws SQLException {
+        ensureNotClosed();
+
+        Connection.super.setShardingKey(shardingKey, superShardingKey);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setShardingKey(ShardingKey shardingKey) throws SQLException {
+        ensureNotClosed();
+
+        Connection.super.setShardingKey(shardingKey);
+    }
+
+    /**
+     * Get the query event handler.
+     *
+     * @return Handler.
+     */
+    public JdbcQueryEventHandler handler() {
+        return handler;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(iface))
+            throw new SQLException("Connection is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface.isAssignableFrom(JdbcConnection.class);
+    }
+
+    /**
+     * Send to the server {@code COMMIT} command.
+     *
+     * @throws SQLException if failed.
+     */
+    private void doCommit() throws SQLException {
+        try (Statement s = createStatement()) {
+            s.execute("COMMIT");
+        }
+    }
+
+    /**
+     * Remove statement from statements set.
+     *
+     * @param stmt Statement to remove.
+     */
+    void removeStatement(JdbcStatement stmt) {
+        synchronized (stmtsMux) {
+            stmts.remove(stmt);
+        }
+    }
+
+    /**
+     * Check cursor options.
+     *
+     * @param resSetType Cursor option.
+     * @param resSetConcurrency Cursor option.
+     * @throws SQLFeatureNotSupportedException If options unsupported.
+     */
+    private void checkCursorOptions(int resSetType, int resSetConcurrency) throws SQLFeatureNotSupportedException {
+        if (resSetType != TYPE_FORWARD_ONLY)
+            throw new SQLFeatureNotSupportedException("Invalid result set type (only forward is supported).");
+
+        if (resSetConcurrency != CONCUR_READ_ONLY)
+            throw new SQLFeatureNotSupportedException("Invalid concurrency (updates are not supported).");
+    }
+
+    /**
+     * Creates address string from HostAndPortRange object.
+     *
+     * @param range HostAndPortRange.
+     * @return Address string with host and port range.
+     */
+    private String createStrAddress(HostAndPortRange range) {
+        String host = range.host();
+        int portFrom = range.portFrom();
+        int portTo = range.portTo();
+
+        boolean ipV6 = host.contains(":");
+
+        if (ipV6)
+            host = "[" + host + "]";
+
+        return host + ":" + (portFrom == portTo ? portFrom : portFrom + ".." + portTo);
+    }
+
+    /**
+     * Normalize schema name. If it is quoted - unquote and leave as is, otherwise - convert to upper case.
+     *
+     * @param schemaName Schema name.
+     * @return Normalized schema name.
+     */
+    public static String normalizeSchema(String schemaName) {
+        if (schemaName == null || schemaName.isEmpty())
+            return SchemaTable.DEFAULT_SCHEMA_NAME;
+
+        String res;
+
+        if (schemaName.startsWith("\"") && schemaName.endsWith("\""))
+            res = schemaName.substring(1, schemaName.length() - 1);
+        else
+            res = schemaName.toUpperCase();
+
+        return res;
+    }
+
+    /**
+     * For test purposes.
+     *
+     * @return Connection properties.
+     */
+    public ConnectionProperties connectionProperties() {
+        return connProps;
+    }
+}
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
new file mode 100644
index 0000000..d3801b9
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
@@ -0,0 +1,529 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLXML;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Objects;
+import org.apache.ignite.client.proto.query.SqlStateCode;
+
+/**
+ * Jdbc prepared statement implementation.
+ */
+public class JdbcPreparedStatement extends JdbcStatement implements PreparedStatement {
+    /** SQL query. */
+    private final String sql;
+
+    /** Query arguments. */
+    private ArrayList<Object> args;
+
+    /**
+     * Creates new prepared statement.
+     *
+     * @param conn Connection.
+     * @param sql SQL query.
+     * @param resHoldability Result set holdability.
+     * @param schema Schema name.
+     */
+    JdbcPreparedStatement(JdbcConnection conn, String sql, int resHoldability, String schema) {
+        super(conn, resHoldability, schema);
+
+        this.sql = sql;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet executeQuery() throws SQLException {
+        executeWithArguments();
+
+        ResultSet rs = getResultSet();
+
+        if (rs == null)
+            throw new SQLException("The query isn't SELECT query: " + sql, SqlStateCode.PARSING_EXCEPTION);
+
+        return rs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate() throws SQLException {
+        executeWithArguments();
+
+        int res = getUpdateCount();
+
+        if (res == -1)
+            throw new SQLException("The query is not DML statement: " + sql, SqlStateCode.PARSING_EXCEPTION);
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute() throws SQLException {
+        executeWithArguments();
+
+        return isQuery();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addBatch() throws SQLException {
+        ensureNotClosed();
+
+        addBatch(sql, args);
+
+        args = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNull(int paramIdx, int sqlType) throws SQLException {
+        setArgument(paramIdx, null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBoolean(int paramIdx, boolean x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setByte(int paramIdx, byte x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setShort(int paramIdx, short x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setInt(int paramIdx, int x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setLong(int paramIdx, long x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFloat(int paramIdx, float x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setDouble(int paramIdx, double x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBigDecimal(int paramIdx, BigDecimal x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setString(int paramIdx, String x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBytes(int paramIdx, byte[] x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setDate(int paramIdx, Date x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTime(int paramIdx, Time x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTimestamp(int paramIdx, Timestamp x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAsciiStream(int paramIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setUnicodeStream(int paramIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBinaryStream(int paramIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearParameters() throws SQLException {
+        ensureNotClosed();
+
+        args = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setObject(int paramIdx, Object x, int targetSqlType) throws SQLException {
+        setArgument(paramIdx, x); //TODO Do we support objects?
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setObject(int paramIdx, Object x) throws SQLException {
+        setArgument(paramIdx, x); //TODO Do we support objects?
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addBatch(String sql) throws SQLException {
+        throw new SQLException("The method 'addBatch(String)' is called on PreparedStatement instance.",
+            SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCharacterStream(int paramIdx, Reader x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setRef(int paramIdx, Ref x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBlob(int paramIdx, Blob x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClob(int paramIdx, Clob x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setArray(int paramIdx, Array x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSetMetaData getMetaData() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Meta data for prepared statement is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setDate(int paramIdx, Date x, Calendar cal) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTime(int paramIdx, Time x, Calendar cal) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTimestamp(int paramIdx, Timestamp x, Calendar cal) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNull(int paramIdx, int sqlType, String typeName) throws SQLException {
+        setNull(paramIdx, sqlType);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setURL(int paramIdx, URL x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Parameter type is unsupported. [cls=" + URL.class + ']');
+    }
+
+    /** {@inheritDoc} */
+    @Override public ParameterMetaData getParameterMetaData() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Parameter metadata are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setRowId(int paramIdx, RowId x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNString(int paramIdx, String val) throws SQLException {
+        ensureNotClosed();
+
+        setString(paramIdx, val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNCharacterStream(int paramIdx, Reader val, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNClob(int paramIdx, NClob val) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClob(int paramIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBlob(int paramIdx, InputStream inputStream, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNClob(int paramIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setSQLXML(int paramIdx, SQLXML xmlObj) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setObject(int paramIdx, Object x, int targetSqlType, int scaleOrLen) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Objects are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAsciiStream(int paramIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBinaryStream(int paramIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCharacterStream(int paramIdx, Reader x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAsciiStream(int paramIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBinaryStream(int paramIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCharacterStream(int paramIdx, Reader x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNCharacterStream(int paramIdx, Reader val) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClob(int paramIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBlob(int paramIdx, InputStream inputStream) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNClob(int paramIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet executeQuery(String sql) throws SQLException {
+        throw new SQLException("The method 'executeQuery(String)' is called on PreparedStatement instance.",
+            SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql) throws SQLException {
+        throw new SQLException("The method 'executeUpdate(String)' is called on PreparedStatement instance.",
+            SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql) throws SQLException {
+        throw new SQLException("The method 'execute(String)' is called on PreparedStatement instance.",
+            SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
+        throw new SQLException("The method 'executeUpdate(String, int)' is called on PreparedStatement instance.",
+            SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, int[] colNames) throws SQLException {
+        throw new SQLException("The method 'executeUpdate(String, int[])' is called on PreparedStatement instance.",
+            SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, String[] colNames) throws SQLException {
+        throw new SQLException("The method 'executeUpdate(String, String[])' is called on PreparedStatement " +
+            "instance.", SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
+        throw new SQLException("The method 'executeUpdate(String, int)' is called on PreparedStatement " +
+            "instance.", SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, int[] colNames) throws SQLException {
+        throw new SQLException("The method 'execute(String, int[])' is called on PreparedStatement " +
+            "instance.", SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, String[] colNames) throws SQLException {
+        throw new SQLException("The method 'execute(String, String[]) is called on PreparedStatement " +
+            "instance.", SqlStateCode.UNSUPPORTED_OPERATION);
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(Objects.requireNonNull(iface)))
+            throw new SQLException("Prepared statement is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface.isAssignableFrom(JdbcPreparedStatement.class);
+    }
+
+    /**
+     * Sets query argument value.
+     *
+     * @param paramIdx Index.
+     * @param val Value.
+     * @throws SQLException If index is invalid.
+     */
+    private void setArgument(int paramIdx, Object val) throws SQLException {
+        ensureNotClosed();
+
+        if (paramIdx < 1)
+            throw new SQLException("Parameter index is invalid: " + paramIdx);
+
+        if (args == null)
+            args = new ArrayList<>(paramIdx);
+
+        while (args.size() < paramIdx)
+            args.add(null);
+
+        args.set(paramIdx - 1, val);
+    }
+
+    /**
+     * Execute query with arguments and nullify them afterwards.
+     *
+     * @throws SQLException If failed.
+     */
+    private void executeWithArguments() throws SQLException {
+        execute0(sql, args);
+    }
+}
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
new file mode 100644
index 0000000..eeab095
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
@@ -0,0 +1,1891 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.ParseException;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+import org.apache.ignite.client.proto.query.IgniteQueryErrorCode;
+import org.apache.ignite.client.proto.query.JdbcQueryEventHandler;
+import org.apache.ignite.client.proto.query.SqlStateCode;
+import org.apache.ignite.client.proto.query.event.QueryCloseRequest;
+import org.apache.ignite.client.proto.query.event.QueryCloseResult;
+import org.apache.ignite.client.proto.query.event.QueryFetchRequest;
+import org.apache.ignite.client.proto.query.event.QueryFetchResult;
+
+/**
+ * Jdbc result set implementation.
+ */
+public class JdbcResultSet implements ResultSet {
+    /** Decimal format to convert string to decimal. */
+    private static final ThreadLocal<DecimalFormat> decimalFormat = new ThreadLocal<>() {
+        /** {@inheritDoc} */
+        @Override protected DecimalFormat initialValue() {
+            DecimalFormatSymbols symbols = new DecimalFormatSymbols();
+
+            symbols.setGroupingSeparator(',');
+            symbols.setDecimalSeparator('.');
+
+            DecimalFormat decimalFormat = new DecimalFormat("", symbols);
+
+            decimalFormat.setParseBigDecimal(true);
+
+            return decimalFormat;
+        }
+    };
+
+    /** Statement. */
+    private final JdbcStatement stmt;
+
+    /** Cursor ID. */
+    private final Long cursorId;
+
+    /** Rows. */
+    private List<List<Object>> rows;
+
+    /** Rows iterator. */
+    private Iterator<List<Object>> rowsIter;
+
+    /** Current row. */
+    private List<Object> curRow;
+
+    /** Current position. */
+    private int curPos;
+
+    /** Finished flag. */
+    private boolean finished;
+
+    /** Closed flag. */
+    private boolean closed;
+
+    /** Was {@code NULL} flag. */
+    private boolean wasNull;
+
+    /** Fetch size. */
+    private int fetchSize;
+
+    /** Is query flag. */
+    private boolean isQuery;
+
+    /** Auto close server cursors flag. */
+    private boolean autoClose;
+
+    /** Update count. */
+    private long updCnt;
+
+    /** Close statement after close result set count. */
+    private boolean closeStmt;
+
+    /** Query request handler. */
+    private JdbcQueryEventHandler qryHandler;
+
+    /**
+     * Creates new result set.
+     *
+     * @param stmt Statement.
+     * @param cursorId Cursor ID.
+     * @param fetchSize Fetch size.
+     * @param finished Finished flag.
+     * @param rows Rows.
+     * @param isQry Is Result ser for Select query.
+     * @param autoClose Is automatic close of server cursors enabled.
+     * @param updCnt Update count.
+     * @param closeStmt Close statement on the result set close.
+     * @param qryHandler QueryEventHandler (local or remote).
+     */
+    JdbcResultSet(JdbcStatement stmt, long cursorId, int fetchSize, boolean finished,
+        List<List<Object>> rows, boolean isQry, boolean autoClose, long updCnt, boolean closeStmt, JdbcQueryEventHandler qryHandler) {
+        assert stmt != null;
+        assert fetchSize > 0;
+
+        this.qryHandler = qryHandler;
+        this.stmt = stmt;
+        this.cursorId = cursorId;
+        this.fetchSize = fetchSize;
+        this.finished = finished;
+        this.isQuery = isQry;
+        this.autoClose = autoClose;
+        this.closeStmt = closeStmt;
+
+        if (isQuery) {
+            this.rows = rows;
+
+            rowsIter = rows != null ? rows.iterator() : null;
+        }
+        else
+            this.updCnt = updCnt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean next() throws SQLException {
+        ensureNotClosed();
+
+        if ((rowsIter == null || !rowsIter.hasNext()) && !finished) {
+            QueryFetchResult res = qryHandler.fetch(new QueryFetchRequest(cursorId, fetchSize));
+
+            if (!res.hasResults())
+                throw IgniteQueryErrorCode.createJdbcSqlException(res.err(), res.status());
+
+            rows = res.items();
+            finished = res.last();
+
+            rowsIter = rows.iterator();
+        }
+
+        if (rowsIter != null) {
+            if (rowsIter.hasNext()) {
+                curRow = rowsIter.next();
+
+                curPos++;
+
+                return true;
+            }
+            else {
+                rowsIter = null;
+                curRow = null;
+
+                return false;
+            }
+        }
+        else
+            return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws SQLException {
+        close0();
+
+        if (closeStmt)
+            stmt.closeIfAllResultsClosed();
+    }
+
+    /**
+     * Close result set.
+     *
+     * @throws SQLException On error.
+     */
+    void close0() throws SQLException {
+        if (isClosed())
+            return;
+
+        try {
+            if (stmt != null && (!finished || (isQuery && !autoClose))) {
+                QueryCloseResult res = qryHandler.close(new QueryCloseRequest(cursorId));
+
+                if (!res.hasResults())
+                    throw IgniteQueryErrorCode.createJdbcSqlException(res.err(), res.status());
+            }
+        }
+        finally {
+            closed = true;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean wasNull() throws SQLException {
+        ensureNotClosed();
+        ensureHasCurrentRow();
+
+        return wasNull;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getString(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        return val == null ? null : String.valueOf(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getBoolean(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return false;
+
+        Class<?> cls = val.getClass();
+
+        if (cls == Boolean.class)
+            return ((Boolean)val);
+        else if (val instanceof Number)
+            return ((Number)val).intValue() != 0;
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return Integer.parseInt(val.toString()) != 0;
+            }
+            catch (NumberFormatException e) {
+                throw new SQLException("Cannot convert to boolean: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to boolean: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte getByte(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return 0;
+
+        Class<?> cls = val.getClass();
+
+        if (val instanceof Number)
+            return ((Number)val).byteValue();
+        else if (cls == Boolean.class)
+            return (Boolean) val ? (byte) 1 : (byte) 0;
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return Byte.parseByte(val.toString());
+            }
+            catch (NumberFormatException e) {
+                throw new SQLException("Cannot convert to byte: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to byte: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public short getShort(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return 0;
+
+        Class<?> cls = val.getClass();
+
+        if (val instanceof Number)
+            return ((Number) val).shortValue();
+        else if (cls == Boolean.class)
+            return (Boolean) val ? (short) 1 : (short) 0;
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return Short.parseShort(val.toString());
+            }
+            catch (NumberFormatException e) {
+                throw new SQLException("Cannot convert to short: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to short: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getInt(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return 0;
+
+        Class<?> cls = val.getClass();
+
+        if (val instanceof Number)
+            return ((Number) val).intValue();
+        else if (cls == Boolean.class)
+            return (Boolean) val ? 1 : 0;
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return Integer.parseInt(val.toString());
+            }
+            catch (NumberFormatException e) {
+                throw new SQLException("Cannot convert to int: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to int: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getLong(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return 0;
+
+        Class<?> cls = val.getClass();
+
+        if (val instanceof Number)
+            return ((Number)val).longValue();
+        else if (cls == Boolean.class)
+            return ((Boolean) val ? 1 : 0);
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return Long.parseLong(val.toString());
+            }
+            catch (NumberFormatException e) {
+                throw new SQLException("Cannot convert to long: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to long: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getFloat(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return 0;
+
+        Class<?> cls = val.getClass();
+
+        if (val instanceof Number)
+            return ((Number) val).floatValue();
+        else if (cls == Boolean.class)
+            return (float) ((Boolean) val ? 1 : 0);
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return Float.parseFloat(val.toString());
+            }
+            catch (NumberFormatException e) {
+                throw new SQLException("Cannot convert to float: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to float: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getDouble(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return 0d;
+
+        Class<?> cls = val.getClass();
+
+        if (val instanceof Number)
+            return ((Number) val).doubleValue();
+        else if (cls == Boolean.class)
+            return ((Boolean) val ? 1d : 0d);
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return Double.parseDouble(val.toString());
+            }
+            catch (NumberFormatException e) {
+                throw new SQLException("Cannot convert to double: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to double: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(int colIdx, int scale) throws SQLException {
+        BigDecimal val = getBigDecimal(colIdx);
+
+        return val == null ? null : val.setScale(scale, RoundingMode.HALF_UP);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] getBytes(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return null;
+
+        Class<?> cls = val.getClass();
+
+        if (cls == byte[].class)
+            return (byte[])val;
+        else if (cls == Byte.class)
+            return new byte[] {(byte)val};
+        else if (cls == Short.class) {
+            short x = (short)val;
+
+            return new byte[] {(byte)(x >> 8), (byte)x};
+        }
+        else if (cls == Integer.class) {
+            int x = (int)val;
+
+            return new byte[] { (byte) (x >> 24), (byte) (x >> 16), (byte) (x >> 8), (byte) x};
+        }
+        else if (cls == Long.class) {
+            long x = (long)val;
+
+            return new byte[] {(byte) (x >> 56), (byte) (x >> 48), (byte) (x >> 40), (byte) (x >> 32),
+                (byte) (x >> 24), (byte) (x >> 16), (byte) (x >> 8), (byte) x};
+        }
+        else if (cls == Float.class)
+            return ByteBuffer.allocate(4).putFloat(((Float)val)).array();
+        else if (cls == Double.class)
+            return ByteBuffer.allocate(8).putDouble(((Double)val)).array();
+        else if (cls == String.class)
+            return ((String)val).getBytes();
+        else if (cls == UUID.class) {
+            ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
+
+            bb.putLong(((UUID)val).getMostSignificantBits());
+            bb.putLong(((UUID)val).getLeastSignificantBits());
+
+            return bb.array();
+        }
+        else
+            throw new SQLException("Cannot convert to byte[]: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return null;
+
+        Class<?> cls = val.getClass();
+
+        if (cls == LocalDate.class)
+            return Date.valueOf((LocalDate)val);
+        else if (cls == LocalTime.class)
+            return new Date(Time.valueOf((LocalTime)val).getTime());
+        else if (cls == Instant.class) {
+            var odlDate = java.util.Date.from((Instant)val);
+            return new Date(odlDate.getTime());
+        }
+        else
+            throw new SQLException("Cannot convert to date: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return null;
+
+        Class<?> cls = val.getClass();
+
+        if (cls == LocalTime.class)
+            return Time.valueOf((LocalTime)val);
+        else if (cls == LocalDate.class)
+            return new Time(Date.valueOf((LocalDate)val).getTime());
+        else if (cls == Instant.class) {
+            var oldTs = Timestamp.from((Instant)val);
+            return new Time(oldTs.getTime());
+        }
+        else
+            throw new SQLException("Cannot convert to time: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return null;
+
+        Class<?> cls = val.getClass();
+
+        if (cls == LocalTime.class)
+            return new Timestamp(Time.valueOf((LocalTime)val).getTime());
+        else if (cls == LocalDate.class)
+            return new Timestamp(Date.valueOf((LocalDate)val).getTime());
+        else if (cls == Instant.class)
+            return Timestamp.from(((Instant)val));
+        else
+            throw new SQLException("Cannot convert to timestamp: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getAsciiStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getUnicodeStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getBinaryStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Stream are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getString(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getString(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getBoolean(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getBoolean(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte getByte(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getByte(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public short getShort(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getShort(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getInt(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getInt(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getLong(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getLong(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getFloat(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getFloat(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getDouble(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getDouble(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(String colLb, int scale) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getBigDecimal(colIdx, scale);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] getBytes(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getBytes(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getDate(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getTime(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getTimestamp(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getAsciiStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getUnicodeStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getBinaryStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLWarning getWarnings() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearWarnings() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getCursorName() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSetMetaData getMetaData() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("ResultSetMetaData are not supported.");
+
+    }
+
+    /** {@inheritDoc} */
+    @Override public int findColumn(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        Objects.requireNonNull(colLb);
+
+        throw new SQLFeatureNotSupportedException("FindColumn by column label are not supported.");
+
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getCharacterStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getCharacterStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return null;
+
+        Class<?> cls = val.getClass();
+
+        if (cls == BigDecimal.class)
+            return (BigDecimal)val;
+        else if (val instanceof Number)
+            return new BigDecimal(((Number)val).doubleValue());
+        else if (cls == Boolean.class)
+            return new BigDecimal((Boolean)val ? 1 : 0);
+        else if (cls == String.class || cls == Character.class) {
+            try {
+                return (BigDecimal)decimalFormat.get().parse(val.toString());
+            }
+            catch (ParseException e) {
+                throw new SQLException("Cannot convert to BigDecimal: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to BigDecimal: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getBigDecimal(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isBeforeFirst() throws SQLException {
+        ensureNotClosed();
+
+        return curPos == 0 && rowsIter != null && rowsIter.hasNext();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isAfterLast() throws SQLException {
+        ensureNotClosed();
+
+        return finished && rowsIter == null && curRow == null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isFirst() throws SQLException {
+        ensureNotClosed();
+
+        return curPos == 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isLast() throws SQLException {
+        ensureNotClosed();
+
+        return finished && rowsIter != null && !rowsIter.hasNext() && curRow != null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void beforeFirst() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void afterLast() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean first() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean last() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getRow() throws SQLException {
+        ensureNotClosed();
+
+        return isAfterLast() ? 0 : curPos;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean absolute(int row) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean relative(int rows) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean previous() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchDirection(int direction) throws SQLException {
+        ensureNotClosed();
+
+        if (direction != FETCH_FORWARD)
+            throw new SQLFeatureNotSupportedException("Only forward direction is supported");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchDirection() throws SQLException {
+        ensureNotClosed();
+
+        return FETCH_FORWARD;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchSize(int fetchSize) throws SQLException {
+        ensureNotClosed();
+
+        if (fetchSize <= 0)
+            throw new SQLException("Fetch size must be greater than zero.");
+
+        this.fetchSize = fetchSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchSize() throws SQLException {
+        ensureNotClosed();
+
+        return fetchSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getType() throws SQLException {
+        ensureNotClosed();
+
+        return stmt.getResultSetType();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getConcurrency() throws SQLException {
+        ensureNotClosed();
+
+        return CONCUR_READ_ONLY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean rowUpdated() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean rowInserted() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean rowDeleted() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNull(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBoolean(int colIdx, boolean x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateByte(int colIdx, byte x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateShort(int colIdx, short x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateInt(int colIdx, int x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateLong(int colIdx, long x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateFloat(int colIdx, float x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDouble(int colIdx, double x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBigDecimal(int colIdx, BigDecimal x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateString(int colIdx, String x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBytes(int colIdx, byte[] x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDate(int colIdx, Date x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTime(int colIdx, Time x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTimestamp(int colIdx, Timestamp x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(int colIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(int colIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(int colIdx, Reader x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(int colIdx, Object x, int scaleOrLen) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(int colIdx, Object x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNull(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBoolean(String colLb, boolean x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateByte(String colLb, byte x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateShort(String colLb, short x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateInt(String colLb, int x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateLong(String colLb, long x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateFloat(String colLb, float x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDouble(String colLb, double x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBigDecimal(String colLb, BigDecimal x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateString(String colLb, String x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBytes(String colLb, byte[] x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDate(String colLb, Date x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTime(String colLb, Time x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTimestamp(String colLb, Timestamp x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(String colLb, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(String colLb, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(String colLb, Reader reader, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(String colLb, Object x, int scaleOrLen) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(String colLb, Object x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void insertRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void deleteRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void refreshRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Row refreshing is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelRowUpdates() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Row updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void moveToInsertRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void moveToCurrentRow() throws SQLException {
+        ensureNotClosed();
+
+        if (getConcurrency() == CONCUR_READ_ONLY)
+            throw new SQLException("The result set concurrency is CONCUR_READ_ONLY");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement getStatement() throws SQLException {
+        ensureNotClosed();
+
+        return stmt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(int colIdx, Map<String, Class<?>> map) throws SQLException {
+        throw new SQLFeatureNotSupportedException("SQL structured type are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Ref getRef(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Blob getBlob(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Clob getClob(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Array getArray(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(String colLb, Map<String, Class<?>> map) throws SQLException {
+        throw new SQLFeatureNotSupportedException("SQL structured type are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Ref getRef(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Blob getBlob(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Clob getClob(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Array getArray(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(int colIdx, Calendar cal) throws SQLException {
+        return getDate(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(String colLb, Calendar cal) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getDate(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(int colIdx, Calendar cal) throws SQLException {
+        return getTime(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(String colLb, Calendar cal) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getTime(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(int colIdx, Calendar cal) throws SQLException {
+        return getTimestamp(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(String colLb, Calendar cal) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getTimestamp(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public URL getURL(int colIdx) throws SQLException {
+        Object val = getValue(colIdx);
+
+        if (val == null)
+            return null;
+
+        Class<?> cls = val.getClass();
+
+        if (cls == URL.class)
+            return (URL)val;
+        else if (cls == String.class) {
+            try {
+                return new URL(val.toString());
+            }
+            catch (MalformedURLException e) {
+                throw new SQLException("Cannot convert to URL: " + val, SqlStateCode.CONVERSION_FAILED, e);
+            }
+        }
+        else
+            throw new SQLException("Cannot convert to URL: " + val, SqlStateCode.CONVERSION_FAILED);
+    }
+
+    /** {@inheritDoc} */
+    @Override public URL getURL(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getURL(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRef(int colIdx, Ref x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRef(String colLb, Ref x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(int colIdx, Blob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(String colLb, Blob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(int colIdx, Clob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(String colLb, Clob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateArray(int colIdx, Array x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateArray(String colLb, Array x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public RowId getRowId(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public RowId getRowId(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRowId(int colIdx, RowId x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRowId(String colLb, RowId x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getHoldability() throws SQLException {
+        ensureNotClosed();
+
+        return HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isClosed() throws SQLException {
+        return closed || stmt == null || stmt.isClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNString(int colIdx, String nStr) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNString(String colLb, String nStr) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(int colIdx, NClob nClob) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(String colLb, NClob nClob) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public NClob getNClob(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public NClob getNClob(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLXML getSQLXML(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLXML getSQLXML(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateSQLXML(int colIdx, SQLXML xmlObj) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateSQLXML(String colLb, SQLXML xmlObj) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getNString(int colIdx) throws SQLException {
+        return getString(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getNString(String colLb) throws SQLException {
+        return getString(colLb);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getNCharacterStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getNCharacterStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(int colIdx, Reader x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(int colIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(int colIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(int colIdx, Reader x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(String colLb, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(String colLb, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(int colIdx, InputStream inputStream, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(String colLb, InputStream inputStream, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(int colIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(int colIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(int colIdx, Reader x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(int colIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(int colIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(int colIdx, Reader x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(String colLb, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(String colLb, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(int colIdx, InputStream inputStream) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(String colLb, InputStream inputStream) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(int colIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(int colIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T getObject(int colIdx, Class<T> targetCls) throws SQLException {
+        ensureNotClosed();
+
+        return (T)getObject0(colIdx, targetCls);
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T getObject(String colLb, Class<T> type) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getObject(colIdx, type);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(int colIdx) throws SQLException {
+        return getValue(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(String colLb) throws SQLException {
+        int colIdx = findColumn(colLb);
+
+        return getValue(colIdx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(iface))
+            throw new SQLException("Result set is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface.isAssignableFrom(JdbcResultSet.class);
+    }
+
+    /**
+     * Get the isQuery flag.
+     *
+     * @return Is query flag.
+     */
+    public boolean isQuery() {
+        return isQuery;
+    }
+
+    /**
+     * Gets object field value by index.
+     *
+     * @param colIdx Column index.
+     * @return Object field value.
+     * @throws SQLException In case of error.
+     */
+    private Object getValue(int colIdx) throws SQLException {
+        ensureNotClosed();
+        ensureHasCurrentRow();
+
+        try {
+            Object val = curRow.get(colIdx - 1);
+
+            wasNull = val == null;
+
+            return val;
+        }
+        catch (IndexOutOfBoundsException e) {
+            throw new SQLException("Invalid column index: " + colIdx, SqlStateCode.PARSING_EXCEPTION, e);
+        }
+    }
+
+    /**
+     * Ensures that result set is positioned on a row.
+     *
+     * @throws SQLException If result set is not positioned on a row.
+     */
+    private void ensureHasCurrentRow() throws SQLException {
+        if (curRow == null)
+            throw new SQLException("Result set is not positioned on a row.");
+    }
+
+    /**
+     * Ensures that result set is not closed.
+     *
+     * @throws SQLException If result set is closed.
+     */
+    private void ensureNotClosed() throws SQLException {
+        if (closed)
+            throw new SQLException("Result set is closed.", SqlStateCode.INVALID_CURSOR_STATE);
+    }
+
+    /**
+     * Get the update count.
+     *
+     * @return Update count for no-SELECT queries.
+     */
+    public long updatedCount() {
+        return updCnt;
+    }
+
+    /**
+     * Set the close statement flag.
+     *
+     * @param closeStmt Close statement on this result set close.
+     */
+    public void closeStatement(boolean closeStmt) {
+        this.closeStmt = closeStmt;
+    }
+
+    /**
+     * Get object of given class.
+     *
+     * @param colIdx Column index.
+     * @param targetCls Class representing the Java data type to convert the designated column to.
+     * @return Converted object.
+     * @throws SQLException On error.
+     */
+    private Object getObject0(int colIdx, Class<?> targetCls) throws SQLException {
+        if (targetCls == Boolean.class)
+            return getBoolean(colIdx);
+        else if (targetCls == Byte.class)
+            return getByte(colIdx);
+        else if (targetCls == Short.class)
+            return getShort(colIdx);
+        else if (targetCls == Integer.class)
+            return getInt(colIdx);
+        else if (targetCls == Long.class)
+            return getLong(colIdx);
+        else if (targetCls == Float.class)
+            return getFloat(colIdx);
+        else if (targetCls == Double.class)
+            return getDouble(colIdx);
+        else if (targetCls == String.class)
+            return getString(colIdx);
+        else if (targetCls == BigDecimal.class)
+            return getBigDecimal(colIdx);
+        else if (targetCls == Date.class)
+            return getDate(colIdx);
+        else if (targetCls == Time.class)
+            return getTime(colIdx);
+        else if (targetCls == Timestamp.class)
+            return getTimestamp(colIdx);
+        else if (targetCls == byte[].class)
+            return getBytes(colIdx);
+        else if (targetCls == URL.class)
+            return getURL(colIdx);
+        else {
+            Object val = getValue(colIdx);
+
+            if (val == null)
+                return null;
+
+            Class<?> cls = val.getClass();
+
+            if (targetCls.isAssignableFrom(cls))
+                return val;
+            else
+                throw new SQLException("Cannot convert to " + targetCls.getName() + ": " + val,
+                    SqlStateCode.CONVERSION_FAILED);
+        }
+    }
+}
diff --git a/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
new file mode 100644
index 0000000..7b41dc5
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
@@ -0,0 +1,657 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc;
+
+import java.sql.BatchUpdateException;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import org.apache.ignite.client.proto.query.IgniteQueryErrorCode;
+import org.apache.ignite.client.proto.query.SqlStateCode;
+import org.apache.ignite.client.proto.query.event.BatchExecuteRequest;
+import org.apache.ignite.client.proto.query.event.BatchExecuteResult;
+import org.apache.ignite.client.proto.query.event.Query;
+import org.apache.ignite.client.proto.query.event.QueryExecuteRequest;
+import org.apache.ignite.client.proto.query.event.QueryExecuteResult;
+import org.apache.ignite.client.proto.query.event.QuerySingleResult;
+import org.apache.ignite.internal.util.ArrayUtils;
+import org.apache.ignite.internal.util.CollectionUtils;
+
+import static java.sql.ResultSet.CONCUR_READ_ONLY;
+import static java.sql.ResultSet.FETCH_FORWARD;
+import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
+
+/**
+ * Jdbc statement implementation.
+ */
+public class JdbcStatement implements Statement {
+    /** Default queryPage size. */
+    private static final int DFLT_PAGE_SIZE = 1024;
+
+    /** JDBC Connection implementation. */
+    private final JdbcConnection conn;
+
+    /** Result set holdability. */
+    private final int resHoldability;
+
+    /** Schema name. */
+    private final String schema;
+
+    /** Closed flag. */
+    private volatile boolean closed;
+
+    /** Query timeout. */
+    private int timeout;
+
+    /** Rows limit. */
+    private int maxRows;
+
+    /** Fetch size. */
+    private int pageSize = DFLT_PAGE_SIZE;
+
+    /** Result sets. */
+    private volatile List<JdbcResultSet> resSets;
+
+    /** Batch. */
+    private List<Query> batch;
+
+    /** Close on completion. */
+    private boolean closeOnCompletion;
+
+    /** Current result index. */
+    private int curRes;
+
+    /**
+     * Creates new statement.
+     *
+     * @param conn JDBC connection.
+     * @param resHoldability Result set holdability.
+     * @param schema Schema name.
+     */
+    JdbcStatement(JdbcConnection conn, int resHoldability, String schema) {
+        assert conn != null;
+
+        this.conn = conn;
+        this.resHoldability = resHoldability;
+        this.schema = schema;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet executeQuery(String sql) throws SQLException {
+        execute0(Objects.requireNonNull(sql), null);
+
+        ResultSet rs = getResultSet();
+
+        if (rs == null)
+            throw new SQLException("The query isn't SELECT query: " + sql, SqlStateCode.PARSING_EXCEPTION);
+
+        return rs;
+    }
+
+    /**
+     * Execute the query with given parameters.
+     *
+     * @param sql Sql query.
+     * @param args Query parameters.
+     *
+     * @throws SQLException Onj error.
+     */
+    protected void execute0(String sql, List<Object> args) throws SQLException {
+        ensureNotClosed();
+
+        closeResults();
+
+        if (sql == null || sql.isEmpty())
+            throw new SQLException("SQL query is empty.");
+
+        QueryExecuteRequest req = new QueryExecuteRequest(schema, pageSize, maxRows, sql,
+            args == null ? ArrayUtils.OBJECT_EMPTY_ARRAY : args.toArray());
+
+        QueryExecuteResult res = conn.handler().query(req);
+
+        if (!res.hasResults())
+            throw IgniteQueryErrorCode.createJdbcSqlException(res.err(), res.status());
+
+        for (QuerySingleResult jdbcRes : res.results()) {
+            if (!jdbcRes.hasResults())
+                throw IgniteQueryErrorCode.createJdbcSqlException(jdbcRes.err(), jdbcRes.status());
+        }
+
+        resSets = new ArrayList<>(res.results().size());
+
+        for (QuerySingleResult jdbcRes : res.results()) {
+            resSets.add(new JdbcResultSet(this, jdbcRes.cursorId(), pageSize,
+                jdbcRes.last(), jdbcRes.items(), jdbcRes.isQuery(), false, jdbcRes.updateCount(),
+                closeOnCompletion, conn.handler()));
+        }
+
+        assert !resSets.isEmpty() : "At least one results set is expected";
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql) throws SQLException {
+        execute0(Objects.requireNonNull(sql), null);
+
+        int res = getUpdateCount();
+
+        if (res == -1) {
+            closeResults();
+            throw new SQLException("The query is not DML statement: " + sql);
+        }
+
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws SQLException {
+        if (isClosed())
+            return;
+
+        try {
+            closeResults();
+
+            conn.removeStatement(this);
+        }
+        finally {
+            closed = true;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxFieldSize() throws SQLException {
+        ensureNotClosed();
+
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setMaxFieldSize(int max) throws SQLException {
+        ensureNotClosed();
+
+        if (max < 0)
+            throw new SQLException("Invalid field limit.");
+
+        throw new SQLFeatureNotSupportedException("Field size limitation is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxRows() throws SQLException {
+        ensureNotClosed();
+
+        return maxRows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setMaxRows(int maxRows) throws SQLException {
+        ensureNotClosed();
+
+        if (maxRows < 0)
+            throw new SQLException("Invalid max rows value.");
+
+        this.maxRows = maxRows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setEscapeProcessing(boolean enable) throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getQueryTimeout() throws SQLException {
+        ensureNotClosed();
+
+        return timeout / 1000;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setQueryTimeout(int timeout) throws SQLException {
+        ensureNotClosed();
+
+        if (timeout < 0)
+            throw new SQLException("Invalid timeout value.");
+
+        //The timeout value of 0 will be converted to Integer.MAX_VALUE timeout to avoid further checks to 0.
+        //This is because zero means there is no timeout limit.
+        timeout(timeout * 1000 > timeout ? timeout * 1000 : Integer.MAX_VALUE);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancel() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Cancellation is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLWarning getWarnings() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearWarnings() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCursorName(String name) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql) throws SQLException {
+        ensureNotClosed();
+
+        execute0(Objects.requireNonNull(sql), null);
+
+        return isQuery();
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getResultSet() throws SQLException {
+        ensureNotClosed();
+
+        if (resSets == null || curRes >= resSets.size())
+            return null;
+
+        JdbcResultSet rs = resSets.get(curRes);
+
+        if (!rs.isQuery())
+            return null;
+
+        return rs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getUpdateCount() throws SQLException {
+        ensureNotClosed();
+
+        if (resSets == null || curRes >= resSets.size())
+            return -1;
+
+        JdbcResultSet rs = resSets.get(curRes);
+
+        if (rs.isQuery())
+            return -1;
+
+        return (int)rs.updatedCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getMoreResults() throws SQLException {
+        return getMoreResults(CLOSE_CURRENT_RESULT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchDirection(int direction) throws SQLException {
+        ensureNotClosed();
+
+        if (direction != FETCH_FORWARD)
+            throw new SQLFeatureNotSupportedException("Only forward direction is supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchDirection() throws SQLException {
+        ensureNotClosed();
+
+        return FETCH_FORWARD;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchSize(int fetchSize) throws SQLException {
+        ensureNotClosed();
+
+        if (fetchSize <= 0)
+            throw new SQLException("Fetch size must be greater than zero.");
+
+        pageSize = fetchSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchSize() throws SQLException {
+        ensureNotClosed();
+
+        return pageSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getResultSetConcurrency() throws SQLException {
+        ensureNotClosed();
+
+        return CONCUR_READ_ONLY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getResultSetType() throws SQLException {
+        ensureNotClosed();
+
+        return TYPE_FORWARD_ONLY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addBatch(String sql) throws SQLException {
+        ensureNotClosed();
+
+        if (batch == null)
+            batch = new ArrayList<>();
+
+        batch.add(new Query(sql, null));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearBatch() throws SQLException {
+        ensureNotClosed();
+
+        batch = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int[] executeBatch() throws SQLException {
+        ensureNotClosed();
+
+        closeResults();
+
+        if (CollectionUtils.nullOrEmpty(batch))
+            return new int[0];
+
+        BatchExecuteRequest req = new BatchExecuteRequest(conn.getSchema(), batch, conn.getAutoCommit());
+
+        try {
+            BatchExecuteResult res = conn.handler().batch(req);
+
+            if (!res.hasResults())
+                throw new BatchUpdateException(res.err(),
+                    IgniteQueryErrorCode.codeToSqlState(res.status()),
+                    res.status(),
+                    res.updateCounts());
+
+            return res.updateCounts();
+        }
+        finally {
+            batch = null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public Connection getConnection() throws SQLException {
+        ensureNotClosed();
+
+        return conn;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getMoreResults(int curr) throws SQLException {
+        ensureNotClosed();
+
+        if (resSets == null || curRes >= resSets.size())
+            return false;
+
+        curRes++;
+
+        if (resSets != null) {
+            assert curRes <= resSets.size() : "Invalid results state: [resultsCount=" + resSets.size() +
+                ", curRes=" + curRes + ']';
+
+            switch (curr) {
+                case CLOSE_CURRENT_RESULT:
+                    if (curRes > 0)
+                        resSets.get(curRes - 1).close0();
+
+                    break;
+
+                case CLOSE_ALL_RESULTS:
+                case KEEP_CURRENT_RESULT:
+                    throw new SQLFeatureNotSupportedException("Multiple open results is not supported.");
+
+                default:
+                    throw new SQLException("Invalid 'current' parameter.");
+            }
+        }
+
+        return (resSets != null && curRes < resSets.size());
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getGeneratedKeys() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Auto-generated columns are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
+        ensureNotClosed();
+
+        switch (autoGeneratedKeys) {
+            case Statement.RETURN_GENERATED_KEYS:
+                throw new SQLFeatureNotSupportedException("Auto-generated columns are not supported.");
+
+            case Statement.NO_GENERATED_KEYS:
+                return executeUpdate(sql);
+
+            default:
+                throw new SQLException("Invalid autoGeneratedKeys value");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, int[] colIndexes) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Auto-generated columns are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, String[] colNames) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Auto-generated columns are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
+        ensureNotClosed();
+
+        switch (autoGeneratedKeys) {
+            case Statement.RETURN_GENERATED_KEYS:
+                throw new SQLFeatureNotSupportedException("Auto-generated columns are not supported.");
+
+            case Statement.NO_GENERATED_KEYS:
+                return execute(sql);
+
+            default:
+                throw new SQLException("Invalid autoGeneratedKeys value.");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, int[] colIndexes) throws SQLException {
+        ensureNotClosed();
+
+        if (colIndexes != null && colIndexes.length > 0)
+            throw new SQLFeatureNotSupportedException("Auto-generated columns are not supported.");
+
+        return execute(sql);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, String[] colNames) throws SQLException {
+        ensureNotClosed();
+
+        if (colNames != null && colNames.length > 0)
+            throw new SQLFeatureNotSupportedException("Auto-generated columns are not supported.");
+
+        return execute(sql);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getResultSetHoldability() throws SQLException {
+        ensureNotClosed();
+
+        return resHoldability;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isClosed() throws SQLException {
+        return conn.isClosed() || closed;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setPoolable(boolean poolable) throws SQLException {
+        ensureNotClosed();
+
+        if (poolable)
+            throw new SQLFeatureNotSupportedException("Pooling is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isPoolable() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void closeOnCompletion() throws SQLException {
+        ensureNotClosed();
+
+        closeOnCompletion = true;
+
+        if (resSets != null) {
+            for (JdbcResultSet rs : resSets)
+                rs.closeStatement(true);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isCloseOnCompletion() throws SQLException {
+        ensureNotClosed();
+
+        return closeOnCompletion;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(Objects.requireNonNull(iface)))
+            throw new SQLException("Statement is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface.isAssignableFrom(JdbcStatement.class);
+    }
+
+    /**
+     * Adds a set of parameters to batch of commands.
+     *
+     * @throws SQLException If statement is closed.
+     */
+    protected void addBatch(String sql, ArrayList<Object> args) throws SQLException {
+        ensureNotClosed();
+
+        if (batch == null) {
+            batch = new ArrayList<>();
+
+            batch.add(new Query(sql, args.toArray()));
+        }
+        else
+            batch.add(new Query(null, args.toArray()));
+    }
+
+    /**
+     * Gets the isQuery flag from the first result.
+     *
+     * @return isQuery flag.
+     */
+    protected boolean isQuery() {
+        return resSets.get(0).isQuery();
+    }
+
+    /**
+     * Ensures that statement not closed.
+     *
+     * @throws SQLException If statement is closed.
+     */
+    void ensureNotClosed() throws SQLException {
+        if (isClosed())
+            throw new SQLException("Statement is closed.");
+    }
+
+    /**
+     * Close results.
+     *
+     * @throws SQLException On error.
+     */
+    private void closeResults() throws SQLException {
+        if (resSets != null) {
+            for (JdbcResultSet rs : resSets)
+                rs.close0();
+
+            resSets = null;
+            curRes = 0;
+        }
+    }
+
+    /**
+     * Used by statement on closeOnCompletion mode.
+     *
+     * @throws SQLException On error.
+     */
+    void closeIfAllResultsClosed() throws SQLException {
+        if (isClosed())
+            return;
+
+        boolean allRsClosed = true;
+
+        if (resSets != null) {
+            for (JdbcResultSet rs : resSets) {
+                if (!rs.isClosed())
+                    allRsClosed = false;
+            }
+        }
+
+        if (allRsClosed)
+            close();
+    }
+
+    /**
+     * Sets timeout in milliseconds.
+     *
+     * For test purposes.
+     *
+     * @param timeout Timeout.
+     * @throws SQLException If timeout condition is not satisfied.
+     */
+    public final void timeout(int timeout) throws SQLException {
+        if (timeout < 0)
+            throw new SQLException("Condition timeout >= 0 is not satisfied.");
+
+        this.timeout = timeout;
+    }
+}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/package-info.java
similarity index 57%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client/src/main/java/org/apache/ignite/internal/jdbc/package-info.java
index d98fa19..d506a9a 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client/src/main/java/org/apache/ignite/internal/jdbc/package-info.java
@@ -15,31 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
-
 /**
- *
+ * Ignite jdbc client internal classes.
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
-
-    /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
-     */
-    void cancelQuery(UUID queryId);
-}
+package org.apache.ignite.internal.jdbc;
\ No newline at end of file
diff --git a/modules/client/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java b/modules/client/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java
new file mode 100644
index 0000000..0378307
--- /dev/null
+++ b/modules/client/src/main/java/org/apache/ignite/jdbc/IgniteJdbcDriver.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.jdbc;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Logger;
+import org.apache.ignite.internal.client.proto.ProtocolVersion;
+import org.apache.ignite.internal.jdbc.ConnectionPropertiesImpl;
+import org.apache.ignite.internal.jdbc.JdbcConnection;
+
+import static org.apache.ignite.internal.jdbc.ConnectionPropertiesImpl.URL_PREFIX;
+
+/**
+ * JDBC driver thin implementation for In-Memory Data Grid.
+ * <p>
+ * Driver allows to get distributed data from Ignite cache using standard
+ * SQL queries and standard JDBC API. It will automatically get only fields that
+ * you actually need from objects stored in cache.
+ */
+public class IgniteJdbcDriver implements Driver {
+    /** Driver instance. */
+    private static final Driver INSTANCE = new IgniteJdbcDriver();
+
+    /** Registered flag. */
+    private static volatile boolean registered;
+
+    static {
+        register();
+    }
+
+    /** Major version. */
+    private static final int MAJOR_VER = ProtocolVersion.LATEST_VER.major();
+
+    /** Minor version. */
+    private static final int MINOR_VER = ProtocolVersion.LATEST_VER.minor();
+
+    /** {@inheritDoc} */
+    @Override public Connection connect(String url, Properties props) throws SQLException {
+        if (!acceptsURL(url))
+            return null;
+
+        ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl();
+
+        connProps.init(url, props);
+
+        return new JdbcConnection(connProps);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean acceptsURL(String url) throws SQLException {
+        return url.startsWith(URL_PREFIX);
+    }
+
+    /** {@inheritDoc} */
+    @Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
+        ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl();
+
+        connProps.init(url, info);
+
+        return connProps.getDriverPropertyInfo();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMajorVersion() {
+        return MAJOR_VER;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMinorVersion() {
+        return MINOR_VER;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean jdbcCompliant() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+        throw new SQLFeatureNotSupportedException("java.util.logging is not used.");
+    }
+
+    /**
+     * Register the driver instance.
+     *
+     * @return Driver instance.
+     * @throws RuntimeException when failed to register driver.
+     */
+    public static synchronized Driver register() {
+        try {
+            if (!registered) {
+                DriverManager.registerDriver(INSTANCE);
+
+                registered = true;
+            }
+        }
+        catch (SQLException e) {
+            throw new RuntimeException("Failed to register Ignite JDBC driver.", e);
+        }
+
+        return INSTANCE;
+    }
+}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client/src/main/java/org/apache/ignite/jdbc/package-info.java
similarity index 57%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client/src/main/java/org/apache/ignite/jdbc/package-info.java
index d98fa19..43afe5a 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client/src/main/java/org/apache/ignite/jdbc/package-info.java
@@ -15,31 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.ignite.internal.util.Cursor;
-
 /**
- *
+ * Ignite jdbc client.
  */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
-
-    /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
-     */
-    void cancelQuery(UUID queryId);
-}
+package org.apache.ignite.jdbc;
diff --git a/modules/client/src/test/java/org/apache/ignite/client/AbstractClientTest.java b/modules/client/src/test/java/org/apache/ignite/client/AbstractClientTest.java
index 79d65d4..63f84f7 100644
--- a/modules/client/src/test/java/org/apache/ignite/client/AbstractClientTest.java
+++ b/modules/client/src/test/java/org/apache/ignite/client/AbstractClientTest.java
@@ -110,7 +110,7 @@ public abstract class AbstractClientTest {
                 local -> local.changePort(port).changePortRange(portRange)
         ).join();
 
-        var module = new ClientHandlerModule(ignite.tables(), cfg);
+        var module = new ClientHandlerModule(((FakeIgnite)ignite).queryEngine(), ignite.tables(), cfg);
         module.start();
 
         return new IgniteBiTuple<>(module, cfg);
diff --git a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeCursor.java b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeCursor.java
new file mode 100644
index 0000000..cd8f5a2
--- /dev/null
+++ b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeCursor.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.client.fakes;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
+import org.apache.ignite.internal.processors.query.calcite.SqlQueryType;
+
+public class FakeCursor implements SqlCursor<List<?>> {
+
+    private final Random random;
+
+    FakeCursor() {
+        random = new Random();
+    }
+
+    @Override public void close() throws Exception {
+
+    }
+
+    @Override public Iterator<List<?>> iterator() {
+        return null;
+    }
+
+    @Override public boolean hasNext() {
+        return true;
+    }
+
+    @Override public List<?> next() {
+        List<Object> result = new ArrayList<>();
+        result.add(random.nextInt());
+        result.add(random.nextLong());
+        result.add(random.nextFloat());
+        result.add(random.nextDouble());
+        result.add(UUID.randomUUID().toString());
+        result.add(null);
+
+        return result;
+    }
+
+    @Override public SqlQueryType getQueryType() {
+        return SqlQueryType.QUERY;
+    }
+}
diff --git a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java
index 0119afd..ad90c5b 100644
--- a/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java
+++ b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgnite.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.client.fakes;
 
 import org.apache.ignite.app.Ignite;
+import org.apache.ignite.internal.processors.query.calcite.QueryProcessor;
 import org.apache.ignite.table.manager.IgniteTables;
 import org.apache.ignite.tx.IgniteTransactions;
 
@@ -25,6 +26,13 @@ import org.apache.ignite.tx.IgniteTransactions;
  * Fake Ignite.
  */
 public class FakeIgnite implements Ignite {
+    /**
+     * Default constructor.
+     */
+    public FakeIgnite() {
+        super();
+    }
+
     /** */
     private final IgniteTables tables = new FakeIgniteTables();
 
@@ -33,13 +41,17 @@ public class FakeIgnite implements Ignite {
         return tables;
     }
 
+    public QueryProcessor queryEngine() {
+        return new FakeIgniteQueryProcessor();
+    }
+
     /** {@inheritDoc} */
     @Override public IgniteTransactions transactions() {
         return null;
     }
 
     /** {@inheritDoc} */
-    @Override public void close() throws Exception {
+    @Override public void close() {
         // No-op.
     }
 
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteQueryProcessor.java
similarity index 59%
copy from modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
copy to modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteQueryProcessor.java
index d98fa19..36e9329 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/client/src/test/java/org/apache/ignite/client/fakes/FakeIgniteQueryProcessor.java
@@ -15,31 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.ignite.internal.processors.query.calcite.exec;
+package org.apache.ignite.client.fakes;
 
+import java.util.Collections;
 import java.util.List;
-import java.util.UUID;
+import org.apache.ignite.internal.processors.query.calcite.QueryProcessor;
+import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
 
-import org.apache.ignite.internal.util.Cursor;
+public class FakeIgniteQueryProcessor implements QueryProcessor {
+    @Override public List<SqlCursor<List<?>>> query(String schemaName, String qry, Object... params) {
+        return Collections.singletonList(new FakeCursor());
+    }
 
-/**
- *
- */
-public interface ExecutionService {
-    /**
-     * Executes a query.
-     *
-     * @param schema Schema name.
-     * @param query Query.
-     * @param params Query parameters.
-     * @return Query cursor.
-     */
-    List<Cursor<List<?>>> executeQuery(String schema, String query, Object[] params);
+    @Override public void start() {
+
+    }
+
+    @Override public void stop() throws Exception {
 
-    /**
-     * Cancels a running query.
-     *
-     * @param queryId Query ID.
-     */
-    void cancelQuery(UUID queryId);
+    }
 }
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/AbstractJdbcSelfTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/AbstractJdbcSelfTest.java
new file mode 100644
index 0000000..d6b13c7
--- /dev/null
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/AbstractJdbcSelfTest.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.runner.app.jdbc;
+
+import java.nio.file.Path;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.app.Ignite;
+import org.apache.ignite.app.IgnitionManager;
+import org.apache.ignite.jdbc.IgniteJdbcDriver;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.function.Executable;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class AbstractJdbcSelfTest {
+    /** URL. */
+    protected static final String URL = "jdbc:ignite:thin://127.0.1.1:10800";
+
+    /** Nodes bootstrap configuration. */
+    private static final Map<String, String> nodesBootstrapCfg = new LinkedHashMap<>() {{
+        put("node0", "{\n" +
+            "  \"node\": {\n" +
+            "    \"metastorageNodes\":[ \"node0\" ]\n" +
+            "  }\n" +
+            "}");
+    }};
+
+    /** Cluster nodes. */
+    private static final List<Ignite> clusterNodes = new ArrayList<>();
+
+    /**
+     * Creates a cluster of three nodes.
+     *
+     * @param temp Temporal directory.
+     */
+    @BeforeAll
+    public static void beforeAll(@TempDir Path temp) {
+        IgniteJdbcDriver.register();
+
+        nodesBootstrapCfg.forEach((nodeName, configStr) ->
+            clusterNodes.add(IgnitionManager.start(nodeName, configStr, temp.resolve(nodeName)))
+        );
+    }
+
+    /**
+     * Close all cluster nodes.
+     *
+     * @throws Exception if failed.
+     */
+    @AfterAll
+    public static void afterAll() throws Exception {
+        for (Ignite clusterNode : clusterNodes) {
+            clusterNode.close();
+        }
+    }
+
+    /**
+     * Checks that the function throws SQLException about a closed result set.
+     *
+     * @param ex Executable function that throws an error.
+     */
+    protected void checkResultSetClosed(Executable ex) {
+        assertThrows(SQLException.class, ex, "Result set is closed");
+    }
+
+    /**
+     * Checks that the function throws SQLException about a closed statement.
+     *
+     * @param ex Executable function that throws an error.
+     */
+    protected void checkStatementClosed(Executable ex) {
+        assertThrows(SQLException.class, ex, "Statement is closed");
+    }
+
+    /**
+     * Checks that the function throws SQLException about a closed connection.
+     *
+     * @param ex Executable function that throws an error.
+     */
+    protected void checkConnectionClosed(Executable ex) {
+        assertThrows(SQLException.class, ex, "Connection is closed");
+    }
+
+    /**
+     * Checks that the function throws SQLFeatureNotSupportedException.
+     *
+     * @param ex Executable function that throws an error.
+     */
+    protected void checkNotSupported(Executable ex) {
+        assertThrows(SQLFeatureNotSupportedException.class, ex);
+    }
+}
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/JdbcConnectionPropertiesTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/JdbcConnectionPropertiesTest.java
new file mode 100644
index 0000000..00f82b7
--- /dev/null
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/JdbcConnectionPropertiesTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.runner.app.jdbc;
+
+import java.sql.DriverPropertyInfo;
+import org.apache.ignite.internal.jdbc.ConnectionPropertiesImpl;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * {@link ConnectionPropertiesImpl} unit tests.
+ */
+public class JdbcConnectionPropertiesTest {
+    /**
+     * Test check the {@link ConnectionPropertiesImpl#getDriverPropertyInfo()} return properties with prefix {@link
+     * ConnectionPropertiesImpl#PROP_PREFIX}
+     */
+    @Test
+    public void testNamePrefixDriverPropertyInfo() {
+        ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl();
+        DriverPropertyInfo[] propsInfo = connProps.getDriverPropertyInfo();
+
+        assertNotEquals(0, propsInfo.length);
+
+        for (DriverPropertyInfo info : propsInfo) {
+            assertTrue(info.name.startsWith(ConnectionPropertiesImpl.PROP_PREFIX));
+        }
+    }
+}
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/JdbcConnectionSelfTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/JdbcConnectionSelfTest.java
new file mode 100644
index 0000000..8427299
--- /dev/null
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/jdbc/JdbcConnectionSelfTest.java
@@ -0,0 +1,1275 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.runner.app.jdbc;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static java.sql.Connection.TRANSACTION_NONE;
+import static java.sql.Connection.TRANSACTION_READ_COMMITTED;
+import static java.sql.Connection.TRANSACTION_READ_UNCOMMITTED;
+import static java.sql.Connection.TRANSACTION_REPEATABLE_READ;
+import static java.sql.Connection.TRANSACTION_SERIALIZABLE;
+import static java.sql.ResultSet.CLOSE_CURSORS_AT_COMMIT;
+import static java.sql.ResultSet.CONCUR_READ_ONLY;
+import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
+import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
+import static java.sql.Statement.NO_GENERATED_KEYS;
+import static java.sql.Statement.RETURN_GENERATED_KEYS;
+import static org.apache.ignite.client.proto.query.SqlStateCode.TRANSACTION_STATE_EXCEPTION;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+/**
+ * Connection test.
+ */
+@SuppressWarnings("ThrowableNotThrown")
+public class JdbcConnectionSelfTest extends AbstractJdbcSelfTest {
+    /**
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings({"EmptyTryBlock", "unused"})
+    @Test
+    public void testDefaults() throws Exception {
+        var url = "jdbc:ignite:thin://127.0.1.1:10800";
+
+        try (Connection conn = DriverManager.getConnection(url)) {
+            // No-op.
+        }
+
+        try (Connection conn = DriverManager.getConnection(url + "/")) {
+            // No-op.
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings({"EmptyTryBlock", "unused"})
+    @Test
+    @Disabled
+    public void testDefaultsIPv6() throws Exception {
+        var url = "jdbc:ignite:thin://[::1]:10800";
+
+        try (Connection conn = DriverManager.getConnection(url)) {
+            // No-op.
+        }
+
+        try (Connection conn = DriverManager.getConnection(url + "/")) {
+            // No-op.
+        }
+    }
+
+    /**
+     * Test invalid endpoint.
+     */
+    @Test
+    public void testInvalidEndpoint() {
+        assertInvalid("jdbc:ignite:thin://", "Address is empty");
+        assertInvalid("jdbc:ignite:thin://:10000", "Host name is empty");
+        assertInvalid("jdbc:ignite:thin://     :10000", "Host name is empty");
+
+        assertInvalid("jdbc:ignite:thin://127.0.0.1:-1", "port range contains invalid port -1");
+        assertInvalid("jdbc:ignite:thin://127.0.0.1:0", "port range contains invalid port 0");
+        assertInvalid("jdbc:ignite:thin://127.0.0.1:100000",
+            "port range contains invalid port 100000");
+
+        assertInvalid("jdbc:ignite:thin://[::1]:-1", "port range contains invalid port -1");
+        assertInvalid("jdbc:ignite:thin://[::1]:0", "port range contains invalid port 0");
+        assertInvalid("jdbc:ignite:thin://[::1]:100000",
+            "port range contains invalid port 100000");
+    }
+
+    /**
+     * Test schema property in URL.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testSchema() throws Exception {
+        assertInvalid(URL + "/qwe/qwe",
+            "Invalid URL format (only schema name is allowed in URL path parameter 'host:port[/schemaName]')" );
+
+        try (Connection conn = DriverManager.getConnection(URL + "/public")) {
+            assertEquals( "PUBLIC", conn.getSchema(), "Invalid schema");
+        }
+
+        String dfltSchema = "DEFAULT";
+
+        try (Connection conn = DriverManager.getConnection(URL + "/\"" + dfltSchema + '"')) {
+            assertEquals(dfltSchema, conn.getSchema(), "Invalid schema");
+        }
+
+        try (Connection conn = DriverManager.getConnection(URL + "/_not_exist_schema_")) {
+            assertEquals("_NOT_EXIST_SCHEMA_", conn.getSchema(), "Invalid schema");
+        }
+    }
+
+    /**
+     * Test schema property in URL with semicolon.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testSchemaSemicolon() throws Exception {
+        String dfltSchema = "DEFAULT";
+
+        try (Connection conn = DriverManager.getConnection(URL + ";schema=public")) {
+            assertEquals("PUBLIC", conn.getSchema(), "Invalid schema");
+        }
+
+        try (Connection conn =
+                 DriverManager.getConnection(URL + ";schema=\"" + dfltSchema + '"')) {
+            assertEquals( dfltSchema, conn.getSchema(), "Invalid schema");
+        }
+
+        try (Connection conn = DriverManager.getConnection(URL + ";schema=_not_exist_schema_")) {
+            assertEquals("_NOT_EXIST_SCHEMA_", conn.getSchema(), "Invalid schema");
+        }
+    }
+
+    /**
+     * Assert that provided URL is invalid.
+     *
+     * @param url URL.
+     * @param errMsg Error message.
+     */
+    private void assertInvalid(final String url, String errMsg) {
+        assertThrows(SQLException.class, () -> DriverManager.getConnection(url), errMsg);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testClose() throws Exception {
+        final Connection conn;
+
+        try (Connection conn0 = DriverManager.getConnection(URL)) {
+            conn = conn0;
+
+            assertNotNull(conn);
+            assertFalse(conn.isClosed());
+        }
+
+        assertTrue(conn.isClosed());
+
+        assertFalse(conn.isValid(2), "Connection must be closed");
+
+        assertThrows(SQLException.class, () -> conn.isValid(-2), "Invalid timeout");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCreateStatement() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            try (Statement stmt = conn.createStatement()) {
+                assertNotNull(stmt);
+
+                stmt.close();
+
+                conn.close();
+
+                // Exception when called on closed connection
+                checkConnectionClosed(() -> conn.createStatement());
+            }
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testCreateStatement2() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            int[] rsTypes = new int[]
+                {TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE};
+
+            int[] rsConcurs = new int[]
+                {CONCUR_READ_ONLY, ResultSet.CONCUR_UPDATABLE};
+
+            DatabaseMetaData meta = conn.getMetaData();
+
+            for (final int type : rsTypes) {
+                for (final int concur : rsConcurs) {
+                    if (meta.supportsResultSetConcurrency(type, concur)) {
+                        assertEquals(TYPE_FORWARD_ONLY, type);
+                        assertEquals(CONCUR_READ_ONLY, concur);
+
+                        try (Statement stmt = conn.createStatement(type, concur)) {
+                            assertNotNull(stmt);
+
+                            assertEquals(type, stmt.getResultSetType());
+                            assertEquals(concur, stmt.getResultSetConcurrency());
+                        }
+
+                        continue;
+                    }
+
+                    assertThrows(SQLFeatureNotSupportedException.class, () -> conn.createStatement(type, concur));
+                }
+            }
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY));
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testCreateStatement3() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            int[] rsTypes = new int[]
+                {TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE};
+
+            int[] rsConcurs = new int[]
+                {CONCUR_READ_ONLY, ResultSet.CONCUR_UPDATABLE};
+
+            int[] rsHoldabilities = new int[]
+                {HOLD_CURSORS_OVER_COMMIT, CLOSE_CURSORS_AT_COMMIT};
+
+            DatabaseMetaData meta = conn.getMetaData();
+
+            for (final int type : rsTypes) {
+                for (final int concur : rsConcurs) {
+                    for (final int holdabililty : rsHoldabilities) {
+                        if (meta.supportsResultSetConcurrency(type, concur)) {
+                            assertEquals(TYPE_FORWARD_ONLY, type);
+                            assertEquals(CONCUR_READ_ONLY, concur);
+
+                            try (Statement stmt = conn.createStatement(type, concur, holdabililty)) {
+                                assertNotNull(stmt);
+
+                                assertEquals(type, stmt.getResultSetType());
+                                assertEquals(concur, stmt.getResultSetConcurrency());
+                                assertEquals(holdabililty, stmt.getResultSetHoldability());
+                            }
+
+                            continue;
+                        }
+
+                        assertThrows(SQLFeatureNotSupportedException.class, 
+                            () -> conn.createStatement(type, concur, holdabililty));
+                    }
+                }
+            }
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testPrepareStatement() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            // null query text
+            assertThrows(
+                NullPointerException.class,
+                () -> conn.prepareStatement(null)
+            );
+
+            final String sqlText = "select * from test where param = ?";
+
+            try (PreparedStatement prepared = conn.prepareStatement(sqlText)) {
+                assertNotNull(prepared);
+            }
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.prepareStatement(sqlText));
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testPrepareStatement3() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            final String sqlText = "select * from test where param = ?";
+
+            int[] rsTypes = new int[]
+                {TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE};
+
+            int[] rsConcurs = new int[]
+                {CONCUR_READ_ONLY, ResultSet.CONCUR_UPDATABLE};
+
+            DatabaseMetaData meta = conn.getMetaData();
+
+            for (final int type : rsTypes) {
+                for (final int concur : rsConcurs) {
+                    if (meta.supportsResultSetConcurrency(type, concur)) {
+                        assertEquals(TYPE_FORWARD_ONLY, type);
+                        assertEquals(CONCUR_READ_ONLY, concur);
+
+                        // null query text
+                        assertThrows(
+                            SQLException.class,
+                            () -> conn.prepareStatement(null, type, concur),
+                            "SQL string cannot be null"
+                        );
+
+                        continue;
+                    }
+
+                    assertThrows(
+                        SQLFeatureNotSupportedException.class,
+                        () -> conn.prepareStatement(sqlText, type, concur)
+                    );
+                }
+            }
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.prepareStatement(sqlText, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY));
+
+            conn.close();
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testPrepareStatement4() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            final String sqlText = "select * from test where param = ?";
+
+            int[] rsTypes = new int[]
+                {TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE};
+
+            int[] rsConcurs = new int[]
+                {CONCUR_READ_ONLY, ResultSet.CONCUR_UPDATABLE};
+
+            int[] rsHoldabilities = new int[]
+                {HOLD_CURSORS_OVER_COMMIT, CLOSE_CURSORS_AT_COMMIT};
+
+            DatabaseMetaData meta = conn.getMetaData();
+
+            for (final int type : rsTypes) {
+                for (final int concur : rsConcurs) {
+                    for (final int holdabililty : rsHoldabilities) {
+                        if (meta.supportsResultSetConcurrency(type, concur)) {
+                            assertEquals(TYPE_FORWARD_ONLY, type);
+                            assertEquals(CONCUR_READ_ONLY, concur);
+
+                            // null query text
+                            assertThrows(
+                                SQLException.class,
+                                () -> conn.prepareStatement(null, type, concur, holdabililty),
+                                "SQL string cannot be null"
+                            );
+
+                            continue;
+                        }
+
+                        assertThrows(
+                            SQLFeatureNotSupportedException.class,
+                            () -> conn.prepareStatement(sqlText, type, concur, holdabililty)
+                        );
+                    }
+                }
+            }
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(
+                () -> conn.prepareStatement(sqlText, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT)
+            );
+
+            conn.close();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testPrepareStatementAutoGeneratedKeysUnsupported() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            final String sqlText = "insert into test (val) values (?)";
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.prepareStatement(sqlText, RETURN_GENERATED_KEYS),
+                "Auto generated keys are not supported."
+            );
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.prepareStatement(sqlText, NO_GENERATED_KEYS),
+                "Auto generated keys are not supported."
+            );
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.prepareStatement(sqlText, new int[] {1}),
+                "Auto generated keys are not supported."
+            );
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.prepareStatement(sqlText, new String[] {"ID"}),
+                "Auto generated keys are not supported."
+            );
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testPrepareCallUnsupported() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            final String sqlText = "exec test()";
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.prepareCall(sqlText),
+                "Callable functions are not supported."
+            );
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.prepareCall(sqlText, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY),
+                "Callable functions are not supported."
+            );
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.prepareCall(sqlText, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT),
+                "Callable functions are not supported."
+            );
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testNativeSql() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            // null query text
+            assertThrows(
+                NullPointerException.class,
+                () -> conn.nativeSQL(null)
+            );
+
+            final String sqlText = "select * from test";
+
+            assertEquals(sqlText, conn.nativeSQL(sqlText));
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.nativeSQL(sqlText));
+        }
+    }
+
+    /**
+     * TODO Enable when transactions are ready.
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testGetSetAutoCommit() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            boolean ac0 = conn.getAutoCommit();
+
+            conn.setAutoCommit(!ac0);
+            // assert no exception
+
+            conn.setAutoCommit(ac0);
+            // assert no exception
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.setAutoCommit(ac0));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testCommit() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            // Should not be called in auto-commit mode
+            assertThrows(
+                SQLException.class,
+                () -> conn.commit(),
+                "Transaction cannot be committed explicitly in auto-commit mode"
+            );
+
+            assertTrue(conn.getAutoCommit());
+
+            // Should not be called in auto-commit mode
+            assertThrows(
+                SQLException.class,
+                () -> conn.commit(),
+                "Transaction cannot be committed explicitly in auto-commit mode."
+            );
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.commit());
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testRollback() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            // Should not be called in auto-commit mode
+            assertThrows(
+                SQLException.class,
+                () -> conn.rollback(),
+                "Transaction cannot be rolled back explicitly in auto-commit mode."
+            );
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.rollback());
+        }
+    }
+
+    /**
+     * Enable when transactions are ready.
+     *
+     * @throws Exception if failed.
+     */
+    @Test
+    @Disabled
+    public void testBeginFailsWhenMvccIsDisabled() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            conn.createStatement().execute("BEGIN");
+
+            fail("Exception is expected");
+        }
+        catch (SQLException e) {
+            assertEquals(TRANSACTION_STATE_EXCEPTION, e.getSQLState());
+        }
+    }
+
+    /**
+     * Enable when transactions are ready.
+     *
+     * @throws Exception if failed.
+     */
+    @Test
+    @Disabled
+    public void testCommitIgnoredWhenMvccIsDisabled() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            conn.setAutoCommit(false);
+            conn.createStatement().execute("COMMIT");
+
+            conn.commit();
+        }
+        // assert no exception
+    }
+
+    /**
+     * Enable when transactions are ready.
+     *
+     * @throws Exception if failed.
+     */
+    @Test
+    @Disabled
+    public void testRollbackIgnoredWhenMvccIsDisabled() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            conn.setAutoCommit(false);
+
+            conn.createStatement().execute("ROLLBACK");
+
+            conn.rollback();
+        }
+        // assert no exception
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testGetMetaData() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            DatabaseMetaData meta = conn.getMetaData();
+
+            assertNotNull(meta);
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.getMetaData());
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testGetSetReadOnly() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.setReadOnly(true));
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.isReadOnly());
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testGetSetCatalog() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            assertFalse(conn.getMetaData().supportsCatalogsInDataManipulation());
+
+            assertNull(conn.getCatalog());
+
+            conn.setCatalog("catalog");
+
+            assertNull(conn.getCatalog());
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.setCatalog(""));
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.getCatalog());
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testGetSetTransactionIsolation() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            // Invalid parameter value
+            assertThrows(
+                SQLException.class,
+                () -> conn.setTransactionIsolation(-1),
+                "Invalid transaction isolation level"
+            );
+
+            // default level
+            assertEquals(TRANSACTION_NONE, conn.getTransactionIsolation());
+
+            int[] levels = {
+                TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED,
+                TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE};
+
+            for (int level : levels) {
+                conn.setTransactionIsolation(level);
+                assertEquals(level, conn.getTransactionIsolation());
+            }
+
+            conn.close();
+
+            // Exception when called on closed connection
+
+            checkConnectionClosed(() -> conn.getTransactionIsolation());
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.setTransactionIsolation(TRANSACTION_SERIALIZABLE));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testClearGetWarnings() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            SQLWarning warn = conn.getWarnings();
+
+            assertNull(warn);
+
+            conn.clearWarnings();
+
+            warn = conn.getWarnings();
+
+            assertNull(warn);
+
+            conn.close();
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.getWarnings());
+
+            // Exception when called on closed connection
+            checkConnectionClosed(() -> conn.clearWarnings());
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Test
+    public void testGetSetTypeMap() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.getTypeMap(),
+                "Types mapping is not supported"
+            );
+
+            assertThrows(
+                SQLFeatureNotSupportedException.class,
+                () -> conn.setTypeMap(new HashMap<String, Class<?>>()),
+                "Types mapping is not supported"
+            );
+            
+            conn.close();
+            
+            // Exception when called on closed connection
+
+            assertThrows(
+                SQLException.class,
+                () -> conn.getTypeMap(),
+                "Connection is closed"
+            );
+
+            assertThrows(
+                SQLException.class,
+                () -> conn.setTypeMap(new HashMap<String, Class<?>>()),
+                "Connection is closed"
+            );
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testGetSetHoldability() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            // default value
+            assertEquals(conn.getMetaData().getResultSetHoldability(), conn.getHoldability());
+
+            assertEquals(HOLD_CURSORS_OVER_COMMIT, conn.getHoldability());
+
+            conn.setHoldability(CLOSE_CURSORS_AT_COMMIT);
+
+            assertEquals(CLOSE_CURSORS_AT_COMMIT, conn.getHoldability());
+
+            // Invalid constant
+            
+            assertThrows(
+                SQLException.class,
+                () -> conn.setHoldability(-1),
+                "Invalid result set holdability value"
+            );
+
+            conn.close();
+
+            assertThrows(
+                SQLException.class,
+                () -> conn.getHoldability(),
+                "Connection is closed"
+            );
+
+            assertThrows(
+                SQLException.class,
+                () -> conn.setHoldability(HOLD_CURSORS_OVER_COMMIT),
+                "Connection is closed"
+            );
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testSetSavepoint() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            assertFalse(conn.getMetaData().supportsSavepoints());
+
+            // Disallowed in auto-commit mode
+            assertThrows(
+                SQLException.class,
+                () -> conn.setSavepoint(),
+                "Savepoint cannot be set in auto-commit mode"
+            );
+
+            conn.close();
+
+            checkConnectionClosed(() -> conn.setSavepoint());
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testSetSavepointName() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            assertFalse(conn.getMetaData().supportsSavepoints());
+
+            // Invalid arg
+            assertThrows(
+                SQLException.class,
+                () -> conn.setSavepoint(null),
+                "Savepoint name cannot be null"
+            );
+
+            final String name = "savepoint";
+
+            // Disallowed in auto-commit mode
+            assertThrows(
+                SQLException.class,
+                () -> conn.setSavepoint(name),
+                "Savepoint cannot be set in auto-commit mode"
+            );
+
+            conn.close();
+
+            checkConnectionClosed(() -> conn.setSavepoint(name));
+        }
+    }
+
+    /**
+     * TODO  IGNITE-15188
+     *
+     * @throws Exception If failed.
+     */
+    @Test
+    @Disabled
+    public void testRollbackSavePoint() throws Exception {
+        try (Connection conn = DriverManager.getConnection(URL)) {
+            assertFalse(conn.getMetaData().supportsSavepoints());
+
+            // Invalid arg
+            assertThrows(
+                SQLException.class,
+                () -> conn.rollback(null),
+                "Invalid savepoint"
+            );
+
+            final Savepoint savepoint = getFakeSavepoint();
+
+            // Disallowed in auto-commit mode
... 2352 lines suppressed ...