You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ni...@apache.org on 2023/02/15 10:45:33 UTC
[ignite] branch master updated: IGNITE-17368 Remove obsolete GridClient JDBC driver (#10473)
This is an automated email from the ASF dual-hosted git repository.
nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new f22ceb2d336 IGNITE-17368 Remove obsolete GridClient JDBC driver (#10473)
f22ceb2d336 is described below
commit f22ceb2d3362f3b95fbbc7f7e680f52345c7d283
Author: Nikolay <ni...@apache.org>
AuthorDate: Wed Feb 15 13:45:24 2023 +0300
IGNITE-17368 Remove obsolete GridClient JDBC driver (#10473)
---
.../internal/jdbc2/JdbcResultSetSelfTest.java | 63 +-
.../ignite/jdbc/JdbcComplexQuerySelfTest.java | 2 +-
.../apache/ignite/jdbc/JdbcConnectionSelfTest.java | 211 ---
.../ignite/jdbc/JdbcDefaultNoOpCacheTest.java | 35 -
.../apache/ignite/jdbc/JdbcEmptyCacheSelfTest.java | 125 --
.../apache/ignite/jdbc/JdbcMetadataSelfTest.java | 419 ------
.../apache/ignite/jdbc/JdbcNoDefaultCacheTest.java | 154 --
.../ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java | 46 -
.../ignite/jdbc/JdbcPreparedStatementSelfTest.java | 779 ----------
.../apache/ignite/jdbc/JdbcResultSetSelfTest.java | 803 ----------
.../apache/ignite/jdbc/JdbcStatementSelfTest.java | 277 ----
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 18 -
.../java/org/apache/ignite/IgniteJdbcDriver.java | 277 +---
.../org/apache/ignite/IgniteJdbcThinDriver.java | 2 +-
.../ignite/internal/jdbc/JdbcConnection.java | 603 --------
.../jdbc/JdbcConnectionValidationTask.java | 54 -
.../ignite/internal/jdbc/JdbcDatabaseMetadata.java | 1327 -----------------
.../internal/jdbc/JdbcPreparedStatement.java | 426 ------
.../apache/ignite/internal/jdbc/JdbcResultSet.java | 1548 --------------------
.../internal/jdbc/JdbcResultSetMetadata.java | 175 ---
.../apache/ignite/internal/jdbc/JdbcStatement.java | 464 ------
.../org/apache/ignite/internal/jdbc/JdbcUtils.java | 257 ----
.../query/jdbc/GridCacheQueryJdbcMetadataTask.java | 186 ---
.../cache/query/jdbc/GridCacheQueryJdbcTask.java | 459 ------
.../jdbc/GridCacheQueryJdbcValidationTask.java | 67 -
.../main/resources/META-INF/classnames.properties | 23 +-
.../yardstick/config/benchmark-query.properties | 1 -
27 files changed, 82 insertions(+), 8719 deletions(-)
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
index 72b580f8b4e..e65bacdc35c 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.jdbc2;
import java.io.Serializable;
+import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
@@ -29,10 +30,12 @@ import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Arrays;
+import java.util.Objects;
import java.util.concurrent.Callable;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteBinary;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
@@ -42,12 +45,12 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
import org.junit.Test;
import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.jdbc.JdbcResultSetSelfTest.assertEqualsToStringRepresentation;
/**
* Result set test.
@@ -1128,4 +1131,62 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest {
return S.toString(TestObjectField.class, this);
}
}
+
+ /**
+ * This does extended toString compare. <p> For binary marshaller result of such BinaryObjectImpl.toString will be unexpected
+ * by this test: <br> <code>org.apache.ignite.jdbc.JdbcResultSetSelfTest$TestObjectField [idHash=1624306582,
+ * hash=11433031, a=100, b=AAAA]</code> <br>
+ *
+ * @param originalObj object initially placed to cache
+ * @param binary optional parameter, if absent, direct toString compare is used
+ * @param resSetObj object returned by result set
+ */
+ public static void assertEqualsToStringRepresentation(
+ final Object originalObj,
+ @Nullable final IgniteBinary binary,
+ final Object resSetObj) {
+ if (binary != null) {
+ final BinaryObject origObjAsBinary = binary.toBinary(originalObj);
+ final String strFromResSet = Objects.toString(resSetObj);
+ for (Field declaredField : originalObj.getClass().getDeclaredFields()) {
+ checkFieldPresenceInToString(origObjAsBinary, strFromResSet, declaredField.getName());
+ }
+ }
+ else
+ assertEquals(originalObj.toString(), Objects.toString(resSetObj));
+ }
+
+ /**
+ * Checks particular field from original binary object
+ *
+ * @param original binary object representation of original object
+ * @param strToCheck string from result set, to be checked for presence of all fields
+ * @param fieldName field name have being checked
+ */
+ private static void checkFieldPresenceInToString(final BinaryObject original,
+ final String strToCheck,
+ final String fieldName) {
+
+ final Object fieldVal = original.field(fieldName);
+ String strValToSearch = Objects.toString(fieldVal);
+ if (fieldVal != null) {
+ final Class<?> aCls = fieldVal.getClass();
+ if (aCls.isArray()) {
+ final Class<?> elemCls = aCls.getComponentType();
+ if (elemCls == Byte.TYPE)
+ strValToSearch = Arrays.toString((byte[])fieldVal);
+ }
+ else if (BinaryObject.class.isAssignableFrom(aCls)) {
+ // hack to avoid search of unpredictable toString representation like
+ // JdbcResultSetSelfTest$TestObjectField [idHash=1518952510, hash=11433031, a=100, b=AAAA]
+ // in toString
+ // other way to fix: iterate on binary object fields: final BinaryObject binVal = (BinaryObject)fieldVal;
+ strValToSearch = "";
+ }
+ }
+ assertTrue("Expected to find field "
+ + fieldName + " having value " + strValToSearch
+ + " in toString representation [" + strToCheck + "]",
+ strToCheck.contains(fieldName + "=" + strValToSearch));
+ }
}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java
index 182ad0e993a..fa589c414d2 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcComplexQuerySelfTest.java
@@ -40,7 +40,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
*/
public class JdbcComplexQuerySelfTest extends GridCommonAbstractTest {
/** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/pers";
+ private static final String URL = "jdbc:ignite:thin://127.0.0.1";
/** Statement. */
private Statement stmt;
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
deleted file mode 100644
index 6e1cc1310bf..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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.DriverManager;
-import java.sql.SQLException;
-import java.util.concurrent.Callable;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
-
-/**
- * Connection test.
- */
-public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
- /** Custom cache name. */
- private static final String CUSTOM_CACHE_NAME = "custom-cache";
-
- /** Custom REST TCP port. */
- private static final int CUSTOM_PORT = 11212;
-
- /** URL prefix. */
- private static final String URL_PREFIX = "jdbc:ignite://";
-
- /** Host. */
- private static final String HOST = "127.0.0.1";
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CUSTOM_CACHE_NAME));
-
- assert cfg.getConnectorConfiguration() == null;
-
- ConnectorConfiguration clientCfg = new ConnectorConfiguration();
-
- if (!igniteInstanceName.endsWith("0"))
- clientCfg.setPort(CUSTOM_PORT);
-
- cfg.setConnectorConfiguration(clientCfg);
-
- return cfg;
- }
-
- /**
- * @param name Cache name.
- * @return Cache configuration.
- * @throws Exception In case of error.
- */
- private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
- CacheConfiguration cfg = defaultCacheConfiguration();
-
- cfg.setName(name);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(2);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDefaults() throws Exception {
- String url = URL_PREFIX + HOST;
-
- assert DriverManager.getConnection(url) != null;
- assert DriverManager.getConnection(url + "/") != null;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNodeId() throws Exception {
- String url = URL_PREFIX + HOST + "/?nodeId=" + grid(0).localNode().id();
-
- assert DriverManager.getConnection(url) != null;
-
- url = URL_PREFIX + HOST + "/" + CUSTOM_CACHE_NAME + "?nodeId=" + grid(0).localNode().id();
-
- assert DriverManager.getConnection(url) != null;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCustomCache() throws Exception {
- String url = URL_PREFIX + HOST + "/" + CUSTOM_CACHE_NAME;
-
- assert DriverManager.getConnection(url) != null;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCustomPort() throws Exception {
- String url = URL_PREFIX + HOST + ":" + CUSTOM_PORT;
-
- assert DriverManager.getConnection(url) != null;
- assert DriverManager.getConnection(url + "/") != null;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testCustomCacheNameAndPort() throws Exception {
- String url = URL_PREFIX + HOST + ":" + CUSTOM_PORT + "/" + CUSTOM_CACHE_NAME;
-
- assert DriverManager.getConnection(url) != null;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testWrongCache() throws Exception {
- final String url = URL_PREFIX + HOST + "/wrongCacheName";
-
- GridTestUtils.assertThrows(
- log,
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- DriverManager.getConnection(url);
-
- return null;
- }
- },
- SQLException.class,
- "Client is invalid. Probably cache name is wrong."
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testWrongPort() throws Exception {
- final String url = URL_PREFIX + HOST + ":33333";
-
- GridTestUtils.assertThrows(
- log,
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- DriverManager.getConnection(url);
-
- return null;
- }
- },
- SQLException.class,
- "Failed to establish connection."
- );
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testClose() throws Exception {
- String url = URL_PREFIX + HOST;
-
- final Connection conn = DriverManager.getConnection(url);
-
- assert conn != null;
- assert !conn.isClosed();
-
- conn.close();
-
- assert conn.isClosed();
-
- GridTestUtils.assertThrows(
- log,
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- conn.isValid(2);
-
- return null;
- }
- },
- SQLException.class,
- "Connection is closed."
- );
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcDefaultNoOpCacheTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcDefaultNoOpCacheTest.java
deleted file mode 100644
index f1143f9012a..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcDefaultNoOpCacheTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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;
-
-/**
- * Test to check JDBC driver behavior when cache specified in connection string does not have any query entities.
- */
-public class JdbcDefaultNoOpCacheTest extends JdbcNoDefaultCacheTest {
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- super.beforeTestsStarted();
-
- ignite(0).getOrCreateCache("noop");
- }
-
- /** {@inheritDoc} */
- @Override protected String getUrl() {
- return super.getUrl() + "noop";
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcEmptyCacheSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcEmptyCacheSelfTest.java
deleted file mode 100644
index 11d4425764b..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcEmptyCacheSelfTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Tests for empty cache.
- */
-public class JdbcEmptyCacheSelfTest extends GridCommonAbstractTest {
- /** Cache name. */
- private static final String CACHE_NAME = "cache";
-
- /** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/" + CACHE_NAME;
-
- /** Statement. */
- private Statement stmt;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- CacheConfiguration cache = defaultCacheConfiguration();
-
- cache.setName(CACHE_NAME);
- cache.setCacheMode(PARTITIONED);
- cache.setBackups(1);
- cache.setWriteSynchronizationMode(FULL_SYNC);
- cache.setIndexedTypes(
- Byte.class, Byte.class
- );
-
- cfg.setCacheConfiguration(cache);
-
- cfg.setConnectorConfiguration(new ConnectorConfiguration());
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrid();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- stmt = DriverManager.getConnection(URL).createStatement();
-
- assert stmt != null;
- assert !stmt.isClosed();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- if (stmt != null) {
- stmt.getConnection().close();
- stmt.close();
-
- assert stmt.isClosed();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testSelectNumber() throws Exception {
- ResultSet rs = stmt.executeQuery("select 1");
-
- int cnt = 0;
-
- while (rs.next()) {
- assert rs.getInt(1) == 1;
- assert "1".equals(rs.getString(1));
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testSelectString() throws Exception {
- ResultSet rs = stmt.executeQuery("select 'str'");
-
- int cnt = 0;
-
- while (rs.next()) {
- assertEquals("str", rs.getString(1));
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
deleted file mode 100644
index 1245d6d840d..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * 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.io.Serializable;
-import java.math.BigDecimal;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.Date;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.affinity.AffinityKey;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static java.sql.Types.DATE;
-import static java.sql.Types.DECIMAL;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.OTHER;
-import static java.sql.Types.VARCHAR;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Metadata tests.
- */
-public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
- /** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/pers";
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setConnectorConfiguration(new ConnectorConfiguration());
-
- return cfg;
- }
-
- /**
- * @return Cache configuration.
- */
- protected CacheConfiguration cacheConfiguration() {
- CacheConfiguration<?, ?> cache = defaultCacheConfiguration();
-
- cache.setCacheMode(PARTITIONED);
- cache.setBackups(1);
- cache.setWriteSynchronizationMode(FULL_SYNC);
-
- return cache;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(3);
-
- IgniteCache<String, Organization> orgCache = jcache(grid(0), cacheConfiguration(), "org",
- String.class, Organization.class);
-
- assert orgCache != null;
-
- orgCache.put("o1", new Organization(1, "A"));
- orgCache.put("o2", new Organization(2, "B"));
-
- IgniteCache<AffinityKey, Person> personCache = jcache(grid(0), cacheConfiguration(), "pers",
- AffinityKey.class, Person.class);
-
- assert personCache != null;
-
- personCache.put(new AffinityKey<>("p1", "o1"), new Person("John White", 25, 1));
- personCache.put(new AffinityKey<>("p2", "o1"), new Person("Joe Black", 35, 1));
- personCache.put(new AffinityKey<>("p3", "o2"), new Person("Mike Green", 40, 2));
-
- jcache(grid(0), cacheConfiguration(), "metaTest", AffinityKey.class, MetaTest.class);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testResultSetMetaData() throws Exception {
- Statement stmt = DriverManager.getConnection(URL).createStatement();
-
- ResultSet rs = stmt.executeQuery(
- "select p.name, o.id as orgId from \"pers\".Person p, \"org\".Organization o where p.orgId = o.id");
-
- assert rs != null;
-
- ResultSetMetaData meta = rs.getMetaData();
-
- assert meta != null;
-
- assert meta.getColumnCount() == 2;
-
- assert "Person".equalsIgnoreCase(meta.getTableName(1));
- assert "name".equalsIgnoreCase(meta.getColumnName(1));
- assert "name".equalsIgnoreCase(meta.getColumnLabel(1));
- assert meta.getColumnType(1) == VARCHAR;
- assert "VARCHAR".equals(meta.getColumnTypeName(1));
- assert "java.lang.String".equals(meta.getColumnClassName(1));
-
- assert "Organization".equalsIgnoreCase(meta.getTableName(2));
- assert "orgId".equalsIgnoreCase(meta.getColumnName(2));
- assert "orgId".equalsIgnoreCase(meta.getColumnLabel(2));
- assert meta.getColumnType(2) == INTEGER;
- assert "INTEGER".equals(meta.getColumnTypeName(2));
- assert "java.lang.Integer".equals(meta.getColumnClassName(2));
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDecimalAndDateTypeMetaData() throws Exception {
- try (Connection conn = DriverManager.getConnection(URL)) {
- Statement stmt = conn.createStatement();
-
- ResultSet rs = stmt.executeQuery(
- "select t.decimal, t.date from \"metaTest\".MetaTest as t");
-
- assert rs != null;
-
- ResultSetMetaData meta = rs.getMetaData();
-
- assert meta != null;
-
- assert meta.getColumnCount() == 2;
-
- assert "METATEST".equalsIgnoreCase(meta.getTableName(1));
- assert "DECIMAL".equalsIgnoreCase(meta.getColumnName(1));
- assert "DECIMAL".equalsIgnoreCase(meta.getColumnLabel(1));
- assert meta.getColumnType(1) == DECIMAL;
- assert "DECIMAL".equals(meta.getColumnTypeName(1));
- assert "java.math.BigDecimal".equals(meta.getColumnClassName(1));
-
- assert "METATEST".equalsIgnoreCase(meta.getTableName(2));
- assert "DATE".equalsIgnoreCase(meta.getColumnName(2));
- assert "DATE".equalsIgnoreCase(meta.getColumnLabel(2));
- assert meta.getColumnType(2) == DATE;
- assert "DATE".equals(meta.getColumnTypeName(2));
- assert "java.sql.Date".equals(meta.getColumnClassName(2));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGetTables() throws Exception {
- try (Connection conn = DriverManager.getConnection(URL)) {
- DatabaseMetaData meta = conn.getMetaData();
-
- ResultSet rs = meta.getTables("", "pers", "%", new String[]{"TABLE"});
- assertNotNull(rs);
- assertTrue(rs.next());
- assertEquals("TABLE", rs.getString("TABLE_TYPE"));
- assertEquals("PERSON", rs.getString("TABLE_NAME"));
-
- rs = meta.getTables("", "org", "%", new String[]{"TABLE"});
- assertNotNull(rs);
- assertTrue(rs.next());
- assertEquals("TABLE", rs.getString("TABLE_TYPE"));
- assertEquals("ORGANIZATION", rs.getString("TABLE_NAME"));
-
- rs = meta.getTables("", "pers", "%", null);
- assertNotNull(rs);
- assertTrue(rs.next());
- assertEquals("TABLE", rs.getString("TABLE_TYPE"));
- assertEquals("PERSON", rs.getString("TABLE_NAME"));
-
- rs = meta.getTables("", "org", "%", null);
- assertNotNull(rs);
- assertTrue(rs.next());
- assertEquals("TABLE", rs.getString("TABLE_TYPE"));
- assertEquals("ORGANIZATION", rs.getString("TABLE_NAME"));
-
- rs = meta.getTables("", "PUBLIC", "", new String[]{"WRONG"});
- assertFalse(rs.next());
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGetColumns() throws Exception {
- final boolean primitivesInformationIsLostAfterStore = ignite(0).configuration().getMarshaller() instanceof BinaryMarshaller;
- try (Connection conn = DriverManager.getConnection(URL)) {
- DatabaseMetaData meta = conn.getMetaData();
-
- ResultSet rs = meta.getColumns("", "pers", "Person", "%");
-
- assert rs != null;
-
- Collection<String> names = new ArrayList<>(2);
-
- names.add("NAME");
- names.add("AGE");
- names.add("ORGID");
-
- int cnt = 0;
-
- while (rs.next()) {
- String name = rs.getString("COLUMN_NAME");
-
- assert names.remove(name);
-
- if ("NAME".equals(name)) {
- assert rs.getInt("DATA_TYPE") == VARCHAR;
- assert "VARCHAR".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == 1;
- }
- else if ("AGE".equals(name) || "ORGID".equals(name)) {
- assert rs.getInt("DATA_TYPE") == INTEGER;
- assert "INTEGER".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == (primitivesInformationIsLostAfterStore ? 1 : 0);
- }
- if ("_KEY".equals(name)) {
- assert rs.getInt("DATA_TYPE") == OTHER;
- assert "OTHER".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == 0;
- }
- if ("_VAL".equals(name)) {
- assert rs.getInt("DATA_TYPE") == OTHER;
- assert "OTHER".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == 0;
- }
-
- cnt++;
- }
-
- assert names.isEmpty();
- assert cnt == 3;
-
- rs = meta.getColumns("", "org", "Organization", "%");
-
- assert rs != null;
-
- names.add("ID");
- names.add("NAME");
-
- cnt = 0;
-
- while (rs.next()) {
- String name = rs.getString("COLUMN_NAME");
-
- assert names.remove(name);
-
- if ("id".equals(name)) {
- assert rs.getInt("DATA_TYPE") == INTEGER;
- assert "INTEGER".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == 0;
- }
- else if ("name".equals(name)) {
- assert rs.getInt("DATA_TYPE") == VARCHAR;
- assert "VARCHAR".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == 1;
- }
- if ("_KEY".equals(name)) {
- assert rs.getInt("DATA_TYPE") == VARCHAR;
- assert "VARCHAR".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == 0;
- }
- if ("_VAL".equals(name)) {
- assert rs.getInt("DATA_TYPE") == OTHER;
- assert "OTHER".equals(rs.getString("TYPE_NAME"));
- assert rs.getInt("NULLABLE") == 0;
- }
-
- cnt++;
- }
-
- assert names.isEmpty();
- assert cnt == 2;
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testMetadataResultSetClose() throws Exception {
- try (Connection conn = DriverManager.getConnection(URL);
- ResultSet tbls = conn.getMetaData().getTables(null, null, "%", null)) {
- int colCnt = tbls.getMetaData().getColumnCount();
-
- while (tbls.next()) {
- for (int i = 0; i < colCnt; i++)
- tbls.getObject(i + 1);
- }
- }
- catch (Exception ignored) {
- fail();
- }
- }
-
- /**
- * Check JDBC support flags.
- */
- @Test
- public void testCheckSupports() throws SQLException {
- try (Connection conn = DriverManager.getConnection(URL)) {
- DatabaseMetaData meta = conn.getMetaData();
-
- assertTrue(meta.supportsANSI92EntryLevelSQL());
- assertTrue(meta.supportsAlterTableWithAddColumn());
- assertTrue(meta.supportsAlterTableWithDropColumn());
- assertTrue(meta.nullPlusNonNullIsNull());
- }
- }
-
- /**
- * Person.
- */
- private static class Person implements Serializable {
- /** Name. */
- @QuerySqlField(index = false)
- private final String name;
-
- /** Age. */
- @QuerySqlField
- private final int age;
-
- /** Organization ID. */
- @QuerySqlField
- private final int orgId;
-
- /**
- * @param name Name.
- * @param age Age.
- * @param orgId Organization ID.
- */
- private Person(String name, int age, int orgId) {
- assert !F.isEmpty(name);
- assert age > 0;
- assert orgId > 0;
-
- this.name = name;
- this.age = age;
- this.orgId = orgId;
- }
- }
-
- /**
- * Organization.
- */
- private static class Organization implements Serializable {
- /** ID. */
- @QuerySqlField
- private final int id;
-
- /** Name. */
- @QuerySqlField(index = false)
- private final String name;
-
- /**
- * @param id ID.
- * @param name Name.
- */
- private Organization(int id, String name) {
- this.id = id;
- this.name = name;
- }
- }
-
- /**
- * Meta Test.
- */
- private static class MetaTest implements Serializable {
- /** ID. */
- @QuerySqlField
- private final int id;
-
- /** Date. */
- @QuerySqlField
- private final Date date;
-
- /** decimal. */
- @QuerySqlField
- private final BigDecimal decimal;
-
- /**
- * @param id ID.
- * @param date Date.
- */
- private MetaTest(int id, Date date, BigDecimal decimal) {
- this.id = id;
- this.date = date;
- this.decimal = decimal;
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
deleted file mode 100644
index 558ff1424a5..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
-
-/**
- *
- */
-public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest {
- /** First cache name. */
- private static final String CACHE1_NAME = "cache1";
-
- /** Second cache name. */
- private static final String CACHE2_NAME = "cache2";
-
- /** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/";
-
- /** Grid count. */
- private static final int GRID_CNT = 2;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setCacheConfiguration(cacheConfiguration(CACHE1_NAME), cacheConfiguration(CACHE2_NAME));
-
- cfg.setConnectorConfiguration(new ConnectorConfiguration());
-
- return cfg;
- }
-
- /**
- * @param name Cache name.
- * @return Cache configuration.
- * @throws Exception In case of error.
- */
- @SuppressWarnings("unchecked")
- private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
- CacheConfiguration cfg = defaultCacheConfiguration();
-
- cfg.setIndexedTypes(Integer.class, Integer.class);
-
- cfg.setName(name);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(GRID_CNT);
-
- Ignite ignite = ignite(0);
-
- IgniteCache<Integer, Integer> cache1 = ignite.cache(CACHE1_NAME);
- IgniteCache<Integer, Integer> cache2 = ignite.cache(CACHE2_NAME);
-
- for (int i = 0; i < 10; i++) {
- cache1.put(i, i * 2);
- cache2.put(i, i * 3);
- }
- }
-
- /**
- * @return Connection URL.
- */
- protected String getUrl() {
- return URL;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDefaults() throws Exception {
- String url = getUrl();
-
- try (Connection conn = DriverManager.getConnection(url)) {
- assertNotNull(conn);
- }
-
- try (Connection conn = DriverManager.getConnection(url + '/')) {
- assertNotNull(conn);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNoCacheNameQuery() throws Exception {
- Statement stmt;
-
- try (Connection conn = DriverManager.getConnection(getUrl())) {
- stmt = conn.createStatement();
-
- assertNotNull(stmt);
- assertFalse(stmt.isClosed());
-
- stmt.execute("select t._key, t._val from \"cache1\".Integer t");
-
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next())
- assertEquals(rs.getInt(2), rs.getInt(1) * 2);
-
- stmt.execute("select t._key, t._val from \"cache2\".Integer t");
-
- rs = stmt.getResultSet();
-
- while (rs.next())
- assertEquals(rs.getInt(2), rs.getInt(1) * 3);
-
- stmt.execute("select t._key, t._val, v._val " +
- "from \"cache1\".Integer t join \"cache2\".Integer v on t._key = v._key");
-
- rs = stmt.getResultSet();
-
- while (rs.next()) {
- assertEquals(rs.getInt(2), rs.getInt(1) * 2);
- assertEquals(rs.getInt(3), rs.getInt(1) * 3);
- }
-
- stmt.close();
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java
deleted file mode 100644
index a685622a1e6..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoLegacyQuerySelfTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.ResultSet;
-import org.junit.Test;
-
-/**
- * Test for Jdbc driver query without class on client
- */
-public class JdbcPojoLegacyQuerySelfTest extends AbstractJdbcPojoQuerySelfTest {
- /** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/";
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testJdbcQuery() throws Exception {
- stmt.execute("select * from JdbcTestObject");
-
- ResultSet rs = stmt.getResultSet();
-
- assertResultSet(rs);
- }
-
- /** {@inheritDoc} */
- @Override protected String getURL() {
- return URL;
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
deleted file mode 100644
index 55d6a63d3ff..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
+++ /dev/null
@@ -1,779 +0,0 @@
-/*
- * 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.io.Serializable;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Date;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static java.sql.Types.BIGINT;
-import static java.sql.Types.BINARY;
-import static java.sql.Types.BOOLEAN;
-import static java.sql.Types.DATALINK;
-import static java.sql.Types.DATE;
-import static java.sql.Types.DOUBLE;
-import static java.sql.Types.FLOAT;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.OTHER;
-import static java.sql.Types.SMALLINT;
-import static java.sql.Types.TIME;
-import static java.sql.Types.TIMESTAMP;
-import static java.sql.Types.TINYINT;
-import static java.sql.Types.VARCHAR;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Prepared statement test.
- */
-public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest {
- /** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/";
-
- /** Connection. */
- private Connection conn;
-
- /** Statement. */
- private PreparedStatement stmt;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- CacheConfiguration<?, ?> cache = defaultCacheConfiguration();
-
- cache.setCacheMode(PARTITIONED);
- cache.setBackups(1);
- cache.setWriteSynchronizationMode(FULL_SYNC);
- cache.setIndexedTypes(
- Integer.class, TestObject.class
- );
-
- cfg.setCacheConfiguration(cache);
-
- cfg.setConnectorConfiguration(new ConnectorConfiguration());
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(3);
-
- IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
-
- assert cache != null;
-
- TestObject o = new TestObject(1);
-
- o.boolVal = true;
- o.byteVal = 1;
- o.shortVal = 1;
- o.intVal = 1;
- o.longVal = 1L;
- o.floatVal = 1.0f;
- o.doubleVal = 1.0d;
- o.bigVal = new BigDecimal(1);
- o.strVal = "str";
- o.arrVal = new byte[] {1};
- o.dateVal = new Date(1);
- o.timeVal = new Time(1);
- o.tsVal = new Timestamp(1);
- o.urlVal = new URL("http://abc.com/");
-
- cache.put(1, o);
- cache.put(2, new TestObject(2));
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- conn = DriverManager.getConnection(URL);
-
- assert conn != null;
- assert !conn.isClosed();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- if (stmt != null) {
- stmt.close();
-
- assert stmt.isClosed();
- }
-
- if (conn != null) {
- conn.close();
-
- assert conn.isClosed();
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRepeatableUsage() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where id = ?");
-
- stmt.setInt(1, 1);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assertEquals(1, rs.getInt(1));
-
- cnt++;
- }
-
- assertEquals(1, cnt);
-
- cnt = 0;
-
- rs = stmt.executeQuery();
-
- while (rs.next()) {
- if (cnt == 0)
- assertEquals(1, rs.getInt(1));
-
- cnt++;
- }
-
- assertEquals(1, cnt);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBoolean() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where boolVal is not distinct from ?");
-
- stmt.setBoolean(1, true);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, BOOLEAN);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testByte() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where byteVal is not distinct from ?");
-
- stmt.setByte(1, (byte)1);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, TINYINT);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testShort() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where shortVal is not distinct from ?");
-
- stmt.setShort(1, (short)1);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, SMALLINT);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testInteger() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where intVal is not distinct from ?");
-
- stmt.setInt(1, 1);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, INTEGER);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLong() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where longVal is not distinct from ?");
-
- stmt.setLong(1, 1L);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, BIGINT);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testFloat() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where floatVal is not distinct from ?");
-
- stmt.setFloat(1, 1.0f);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, FLOAT);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDouble() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where doubleVal is not distinct from ?");
-
- stmt.setDouble(1, 1.0d);
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, DOUBLE);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBigDecimal() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where bigVal is not distinct from ?");
-
- stmt.setBigDecimal(1, new BigDecimal(1));
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, OTHER);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testString() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where strVal is not distinct from ?");
-
- stmt.setString(1, "str");
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, VARCHAR);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testArray() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where arrVal is not distinct from ?");
-
- stmt.setBytes(1, new byte[] {1});
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, BINARY);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDate() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where dateVal is not distinct from ?");
-
- stmt.setObject(1, new Date(1));
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, DATE);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTime() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where timeVal is not distinct from ?");
-
- stmt.setTime(1, new Time(1));
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, TIME);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTimestamp() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where tsVal is not distinct from ?");
-
- stmt.setTimestamp(1, new Timestamp(1));
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, TIMESTAMP);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testUrl() throws Exception {
- stmt = conn.prepareStatement("select * from TestObject where urlVal is not distinct from ?");
-
- stmt.setURL(1, new URL("http://abc.com/"));
-
- ResultSet rs = stmt.executeQuery();
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 1;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setNull(1, DATALINK);
-
- rs = stmt.executeQuery();
-
- cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0)
- assert rs.getInt("id") == 2;
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * Test object.
- */
- private static class TestObject implements Serializable {
- /** */
- @QuerySqlField(index = false)
- private final int id;
-
- /** */
- @QuerySqlField
- private Boolean boolVal;
-
- /** */
- @QuerySqlField
- private Byte byteVal;
-
- /** */
- @QuerySqlField
- private Short shortVal;
-
- /** */
- @QuerySqlField
- private Integer intVal;
-
- /** */
- @QuerySqlField
- private Long longVal;
-
- /** */
- @QuerySqlField
- private Float floatVal;
-
- /** */
- @QuerySqlField
- private Double doubleVal;
-
- /** */
- @QuerySqlField
- private BigDecimal bigVal;
-
- /** */
- @QuerySqlField
- private String strVal;
-
- /** */
- @QuerySqlField
- private byte[] arrVal;
-
- /** */
- @QuerySqlField
- private Date dateVal;
-
- /** */
- @QuerySqlField
- private Time timeVal;
-
- /** */
- @QuerySqlField
- private Timestamp tsVal;
-
- /** */
- @QuerySqlField
- private URL urlVal;
-
- /**
- * @param id ID.
- */
- private TestObject(int id) {
- this.id = id;
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
deleted file mode 100644
index d0f127edae0..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
+++ /dev/null
@@ -1,803 +0,0 @@
-/*
- * 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.io.Serializable;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.sql.Date;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.Objects;
-import java.util.concurrent.Callable;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteBinary;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.Nullable;
-import org.junit.Test;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Result set test.
- */
-@SuppressWarnings("FloatingPointEquality")
-public class JdbcResultSetSelfTest extends GridCommonAbstractTest {
- /** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/";
-
- /** SQL query. */
- private static final String SQL =
- "select id, boolVal, byteVal, shortVal, intVal, longVal, floatVal, " +
- "doubleVal, bigVal, strVal, arrVal, dateVal, timeVal, tsVal, urlVal, f1, f2, f3, _val " +
- "from TestObject where id = 1";
-
- /** Statement. */
- private Statement stmt;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- CacheConfiguration<?, ?> cache = defaultCacheConfiguration();
-
- cache.setCacheMode(PARTITIONED);
- cache.setBackups(1);
- cache.setWriteSynchronizationMode(FULL_SYNC);
- cache.setIndexedTypes(
- Integer.class, TestObject.class
- );
-
- cfg.setCacheConfiguration(cache);
-
- cfg.setConnectorConfiguration(new ConnectorConfiguration());
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(3);
-
- IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
-
- assert cache != null;
-
- TestObject o = createObjectWithData(1);
-
- cache.put(1, o);
- cache.put(2, new TestObject(2));
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- stmt = DriverManager.getConnection(URL).createStatement();
-
- assert stmt != null;
- assert !stmt.isClosed();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- if (stmt != null) {
- stmt.getConnection().close();
- stmt.close();
-
- assert stmt.isClosed();
- }
- }
-
- /**
- * @param id ID.
- * @return Object.
- * @throws MalformedURLException If URL in incorrect.
- */
- @SuppressWarnings("deprecation")
- private TestObject createObjectWithData(int id) throws MalformedURLException {
- TestObject o = new TestObject(id);
-
- o.boolVal = true;
- o.byteVal = 1;
- o.shortVal = 1;
- o.intVal = 1;
- o.longVal = 1L;
- o.floatVal = 1.0f;
- o.doubleVal = 1.0d;
- o.bigVal = new BigDecimal(1);
- o.strVal = "str";
- o.arrVal = new byte[] {1};
- o.dateVal = new Date(1, 1, 1);
- o.timeVal = new Time(1, 1, 1);
- o.tsVal = new Timestamp(1);
- o.urlVal = new URL("http://abc.com/");
-
- return o;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBoolean() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getBoolean("boolVal");
- assert rs.getBoolean(2);
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testByte() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getByte("byteVal") == 1;
- assert rs.getByte(3) == 1;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testShort() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getShort("shortVal") == 1;
- assert rs.getShort(4) == 1;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testInteger() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getInt("intVal") == 1;
- assert rs.getInt(5) == 1;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testLong() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getLong("longVal") == 1;
- assert rs.getLong(6) == 1;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testFloat() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getFloat("floatVal") == 1.0;
- assert rs.getFloat(7) == 1.0;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDouble() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getDouble("doubleVal") == 1.0;
- assert rs.getDouble(8) == 1.0;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testBigDecimal() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getBigDecimal("bigVal").intValue() == 1;
- assert rs.getBigDecimal(9).intValue() == 1;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testString() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert "str".equals(rs.getString("strVal"));
- assert "str".equals(rs.getString(10));
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testArray() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert Arrays.equals(rs.getBytes("arrVal"), new byte[] {1});
- assert Arrays.equals(rs.getBytes(11), new byte[] {1});
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @SuppressWarnings("deprecation")
- @Test
- public void testDate() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getDate("dateVal").equals(new Date(1, 1, 1));
- assert rs.getDate(12).equals(new Date(1, 1, 1));
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @SuppressWarnings("deprecation")
- @Test
- public void testTime() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getTime("timeVal").equals(new Time(1, 1, 1));
- assert rs.getTime(13).equals(new Time(1, 1, 1));
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testTimestamp() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assert rs.getTimestamp("tsVal").getTime() == 1;
- assert rs.getTimestamp(14).getTime() == 1;
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testUrl() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- int cnt = 0;
-
- while (rs.next()) {
- if (cnt == 0) {
- assertTrue("http://abc.com/".equals(rs.getURL("urlVal").toString()));
- assertTrue("http://abc.com/".equals(rs.getURL(15).toString()));
- }
-
- cnt++;
- }
-
- assert cnt == 1;
- }
-
- /**
- * This does extended toString compare. <br> Actual toString in case binary is enabled is called at {@link
- * org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask.JdbcDriverJob#execute()}, <br>
- * org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java:312 <br> and then strings are
- * compared in assertions <p> And for binary marshaller result of such BinaryObjectImpl.toString will be unexpected
- * by this test: <br> <code>org.apache.ignite.jdbc.JdbcResultSetSelfTest$TestObjectField [idHash=1624306582,
- * hash=11433031, a=100, b=AAAA]</code> <br>
- *
- * @param originalObj object initially placed to cache
- * @param binary optional parameter, if absent, direct toString compare is used
- * @param resSetObj object returned by result set
- */
- public static void assertEqualsToStringRepresentation(
- final Object originalObj,
- @Nullable final IgniteBinary binary,
- final Object resSetObj) {
- if (binary != null) {
- final BinaryObject origObjAsBinary = binary.toBinary(originalObj);
- final String strFromResSet = Objects.toString(resSetObj);
- for (Field declaredField : originalObj.getClass().getDeclaredFields()) {
- checkFieldPresenceInToString(origObjAsBinary, strFromResSet, declaredField.getName());
- }
- }
- else
- assertEquals(originalObj.toString(), Objects.toString(resSetObj));
- }
-
- /**
- * Checks particular field from original binary object
- *
- * @param original binary object representation of original object
- * @param strToCheck string from result set, to be checked for presence of all fields
- * @param fieldName field name have being checked
- */
- private static void checkFieldPresenceInToString(final BinaryObject original,
- final String strToCheck,
- final String fieldName) {
-
- final Object fieldVal = original.field(fieldName);
- String strValToSearch = Objects.toString(fieldVal);
- if (fieldVal != null) {
- final Class<?> aCls = fieldVal.getClass();
- if (aCls.isArray()) {
- final Class<?> elemCls = aCls.getComponentType();
- if (elemCls == Byte.TYPE)
- strValToSearch = Arrays.toString((byte[])fieldVal);
- }
- else if (BinaryObject.class.isAssignableFrom(aCls)) {
- // hack to avoid search of unpredictable toString representation like
- // JdbcResultSetSelfTest$TestObjectField [idHash=1518952510, hash=11433031, a=100, b=AAAA]
- // in toString
- // other way to fix: iterate on binary object fields: final BinaryObject binVal = (BinaryObject)fieldVal;
- strValToSearch = "";
- }
- }
- assertTrue("Expected to find field "
- + fieldName + " having value " + strValToSearch
- + " in toString representation [" + strToCheck + "]",
- strToCheck.contains(fieldName + "=" + strValToSearch));
- }
-
- /**
- * @param str initial toString representation from binary object
- * @return same representation with removed ID hash value
- */
- private static String removeIdHash(String str) {
- return str.replaceAll("idHash=(\\d)*", "idHash=...");
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testObject() throws Exception {
- final Ignite ignite = ignite(0);
- final boolean binaryMarshaller = ignite.configuration().getMarshaller() instanceof BinaryMarshaller;
- final IgniteBinary binary = binaryMarshaller ? ignite.binary() : null;
-
- ResultSet rs = stmt.executeQuery(SQL);
-
- TestObjectField f1 = new TestObjectField(100, "AAAA");
- TestObjectField f2 = new TestObjectField(500, "BBBB");
-
- TestObject o = createObjectWithData(1);
-
- assertTrue(rs.next());
- assertEqualsToStringRepresentation(f1, binary, rs.getObject("f1"));
- assertEqualsToStringRepresentation(f1, binary, rs.getObject(16));
-
- assertEqualsToStringRepresentation(f2, binary, rs.getObject("f2"));
- assertEqualsToStringRepresentation(f2, binary, rs.getObject(17));
-
- assertNull(rs.getObject("f3"));
- assertTrue(rs.wasNull());
- assertNull(rs.getObject(18));
- assertTrue(rs.wasNull());
-
- assertEqualsToStringRepresentation(o, binary, rs.getObject("_val"));
- assertEqualsToStringRepresentation(o, binary, rs.getObject(19));
-
- assertFalse(rs.next());
- }
-
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testNavigation() throws Exception {
- ResultSet rs = stmt.executeQuery("select * from TestObject where id > 0");
-
- assert rs.isBeforeFirst();
- assert !rs.isAfterLast();
- assert !rs.isFirst();
- assert !rs.isLast();
- assert rs.getRow() == 0;
-
- assert rs.next();
-
- assert !rs.isBeforeFirst();
- assert !rs.isAfterLast();
- assert rs.isFirst();
- assert !rs.isLast();
- assert rs.getRow() == 1;
-
- assert rs.next();
-
- assert !rs.isBeforeFirst();
- assert !rs.isAfterLast();
- assert !rs.isFirst();
- assert rs.isLast();
- assert rs.getRow() == 2;
-
- assert !rs.next();
-
- assert !rs.isBeforeFirst();
- assert rs.isAfterLast();
- assert !rs.isFirst();
- assert !rs.isLast();
- assert rs.getRow() == 0;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testFindColumn() throws Exception {
- final ResultSet rs = stmt.executeQuery(SQL);
-
- assert rs != null;
- assert rs.next();
-
- assert rs.findColumn("id") == 1;
-
- GridTestUtils.assertThrows(
- log,
- new Callable<Object>() {
- @Override public Object call() throws Exception {
- rs.findColumn("wrong");
-
- return null;
- }
- },
- SQLException.class,
- "Column not found: wrong"
- );
- }
-
- /**
- * Test object.
- */
- private static class TestObject implements Serializable {
- /** */
- @QuerySqlField
- private final int id;
-
- /** */
- @QuerySqlField(index = false)
- private Boolean boolVal;
-
- /** */
- @QuerySqlField(index = false)
- private Byte byteVal;
-
- /** */
- @QuerySqlField(index = false)
- private Short shortVal;
-
- /** */
- @QuerySqlField(index = false)
- private Integer intVal;
-
- /** */
- @QuerySqlField(index = false)
- private Long longVal;
-
- /** */
- @QuerySqlField(index = false)
- private Float floatVal;
-
- /** */
- @QuerySqlField(index = false)
- private Double doubleVal;
-
- /** */
- @QuerySqlField(index = false)
- private BigDecimal bigVal;
-
- /** */
- @QuerySqlField(index = false)
- private String strVal;
-
- /** */
- @QuerySqlField(index = false)
- private byte[] arrVal;
-
- /** */
- @QuerySqlField(index = false)
- private Date dateVal;
-
- /** */
- @QuerySqlField(index = false)
- private Time timeVal;
-
- /** */
- @QuerySqlField(index = false)
- private Timestamp tsVal;
-
- /** */
- @QuerySqlField(index = false)
- private URL urlVal;
-
- /** */
- @QuerySqlField(index = false)
- private TestObjectField f1 = new TestObjectField(100, "AAAA");
-
- /** */
- @QuerySqlField(index = false)
- private TestObjectField f2 = new TestObjectField(500, "BBBB");
-
- /** */
- @QuerySqlField(index = false)
- private TestObjectField f3;
-
- /**
- * @param id ID.
- */
- private TestObject(int id) {
- this.id = id;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(TestObject.class, this);
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings({"BigDecimalEquals", "EqualsHashCodeCalledOnUrl", "RedundantIfStatement"})
- @Override public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- TestObject that = (TestObject)o;
-
- if (id != that.id) return false;
- if (!Arrays.equals(arrVal, that.arrVal)) return false;
- if (bigVal != null ? !bigVal.equals(that.bigVal) : that.bigVal != null) return false;
- if (boolVal != null ? !boolVal.equals(that.boolVal) : that.boolVal != null) return false;
- if (byteVal != null ? !byteVal.equals(that.byteVal) : that.byteVal != null) return false;
- if (dateVal != null ? !dateVal.equals(that.dateVal) : that.dateVal != null) return false;
- if (doubleVal != null ? !doubleVal.equals(that.doubleVal) : that.doubleVal != null) return false;
- if (f1 != null ? !f1.equals(that.f1) : that.f1 != null) return false;
- if (f2 != null ? !f2.equals(that.f2) : that.f2 != null) return false;
- if (f3 != null ? !f3.equals(that.f3) : that.f3 != null) return false;
- if (floatVal != null ? !floatVal.equals(that.floatVal) : that.floatVal != null) return false;
- if (intVal != null ? !intVal.equals(that.intVal) : that.intVal != null) return false;
- if (longVal != null ? !longVal.equals(that.longVal) : that.longVal != null) return false;
- if (shortVal != null ? !shortVal.equals(that.shortVal) : that.shortVal != null) return false;
- if (strVal != null ? !strVal.equals(that.strVal) : that.strVal != null) return false;
- if (timeVal != null ? !timeVal.equals(that.timeVal) : that.timeVal != null) return false;
- if (tsVal != null ? !tsVal.equals(that.tsVal) : that.tsVal != null) return false;
- if (urlVal != null ? !urlVal.equals(that.urlVal) : that.urlVal != null) return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("EqualsHashCodeCalledOnUrl")
- @Override public int hashCode() {
- int res = id;
-
- res = 31 * res + (boolVal != null ? boolVal.hashCode() : 0);
- res = 31 * res + (byteVal != null ? byteVal.hashCode() : 0);
- res = 31 * res + (shortVal != null ? shortVal.hashCode() : 0);
- res = 31 * res + (intVal != null ? intVal.hashCode() : 0);
- res = 31 * res + (longVal != null ? longVal.hashCode() : 0);
- res = 31 * res + (floatVal != null ? floatVal.hashCode() : 0);
- res = 31 * res + (doubleVal != null ? doubleVal.hashCode() : 0);
- res = 31 * res + (bigVal != null ? bigVal.hashCode() : 0);
- res = 31 * res + (strVal != null ? strVal.hashCode() : 0);
- res = 31 * res + (arrVal != null ? Arrays.hashCode(arrVal) : 0);
- res = 31 * res + (dateVal != null ? dateVal.hashCode() : 0);
- res = 31 * res + (timeVal != null ? timeVal.hashCode() : 0);
- res = 31 * res + (tsVal != null ? tsVal.hashCode() : 0);
- res = 31 * res + (urlVal != null ? urlVal.hashCode() : 0);
- res = 31 * res + (f1 != null ? f1.hashCode() : 0);
- res = 31 * res + (f2 != null ? f2.hashCode() : 0);
- res = 31 * res + (f3 != null ? f3.hashCode() : 0);
-
- return res;
- }
- }
-
- /**
- * Test object field.
- */
- @SuppressWarnings("PackageVisibleField")
- private static class TestObjectField implements Serializable {
- /** */
- @GridToStringInclude final int a;
-
- /** */
- @GridToStringInclude final String b;
-
- /**
- * @param a A.
- * @param b B.
- */
- private TestObjectField(int a, String b) {
- this.a = a;
- this.b = b;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- TestObjectField that = (TestObjectField)o;
-
- return a == that.a && !(b != null ? !b.equals(that.b) : that.b != null);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = a;
-
- res = 31 * res + (b != null ? b.hashCode() : 0);
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(TestObjectField.class, this);
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
deleted file mode 100644
index 5cc41d29373..00000000000
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * 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.io.Serializable;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.ConnectorConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Statement test.
- */
-public class JdbcStatementSelfTest extends GridCommonAbstractTest {
- /** URL. */
- private static final String URL = "jdbc:ignite://127.0.0.1/";
-
- /** SQL query. */
- private static final String SQL = "select * from Person where age > 30";
-
- /** Connection. */
- private Connection conn;
-
- /** Statement. */
- private Statement stmt;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- CacheConfiguration<?, ?> cache = defaultCacheConfiguration();
-
- cache.setCacheMode(PARTITIONED);
- cache.setBackups(1);
- cache.setWriteSynchronizationMode(FULL_SYNC);
- cache.setIndexedTypes(
- String.class, Person.class
- );
-
- cfg.setCacheConfiguration(cache);
-
- cfg.setConnectorConfiguration(new ConnectorConfiguration());
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGridsMultiThreaded(3);
-
- IgniteCache<String, Person> cache = grid(0).cache(DEFAULT_CACHE_NAME);
-
- assert cache != null;
-
- cache.put("p1", new Person(1, "John", "White", 25));
- cache.put("p2", new Person(2, "Joe", "Black", 35));
- cache.put("p3", new Person(3, "Mike", "Green", 40));
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- conn = DriverManager.getConnection(URL);
- stmt = conn.createStatement();
-
- assert stmt != null;
- assert !stmt.isClosed();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- if (stmt != null && !stmt.isClosed())
- stmt.close();
-
- conn.close();
-
- assert stmt.isClosed();
- assert conn.isClosed();
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testExecuteQuery() throws Exception {
- ResultSet rs = stmt.executeQuery(SQL);
-
- assert rs != null;
-
- int cnt = 0;
-
- while (rs.next()) {
- int id = rs.getInt("id");
-
- if (id == 2) {
- assert "Joe".equals(rs.getString("firstName"));
- assert "Black".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 35;
- }
- else if (id == 3) {
- assert "Mike".equals(rs.getString("firstName"));
- assert "Green".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 40;
- }
- else
- assert false : "Wrong ID: " + id;
-
- cnt++;
- }
-
- assert cnt == 2;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testExecute() throws Exception {
- assert stmt.execute(SQL);
-
- ResultSet rs = stmt.getResultSet();
-
- assert rs != null;
-
- assert stmt.getResultSet() == null;
-
- int cnt = 0;
-
- while (rs.next()) {
- int id = rs.getInt("id");
-
- if (id == 2) {
- assert "Joe".equals(rs.getString("firstName"));
- assert "Black".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 35;
- }
- else if (id == 3) {
- assert "Mike".equals(rs.getString("firstName"));
- assert "Green".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 40;
- }
- else
- assert false : "Wrong ID: " + id;
-
- cnt++;
- }
-
- assert cnt == 2;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testMaxRows() throws Exception {
- stmt.setMaxRows(1);
-
- ResultSet rs = stmt.executeQuery(SQL);
-
- assert rs != null;
-
- int cnt = 0;
-
- while (rs.next()) {
- int id = rs.getInt("id");
-
- if (id == 2) {
- assert "Joe".equals(rs.getString("firstName"));
- assert "Black".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 35;
- }
- else if (id == 3) {
- assert "Mike".equals(rs.getString("firstName"));
- assert "Green".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 40;
- }
- else
- assert false : "Wrong ID: " + id;
-
- cnt++;
- }
-
- assert cnt == 1;
-
- stmt.setMaxRows(0);
-
- rs = stmt.executeQuery(SQL);
-
- assert rs != null;
-
- cnt = 0;
-
- while (rs.next()) {
- int id = rs.getInt("id");
-
- if (id == 2) {
- assert "Joe".equals(rs.getString("firstName"));
- assert "Black".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 35;
- }
- else if (id == 3) {
- assert "Mike".equals(rs.getString("firstName"));
- assert "Green".equals(rs.getString("lastName"));
- assert rs.getInt("age") == 40;
- }
- else
- assert false : "Wrong ID: " + id;
-
- cnt++;
- }
-
- assert cnt == 2;
- }
-
- /**
- * Person.
- */
- private static class Person implements Serializable {
- /** ID. */
- @QuerySqlField
- private final int id;
-
- /** First name. */
- @QuerySqlField(index = false)
- private final String firstName;
-
- /** Last name. */
- @QuerySqlField(index = false)
- private final String lastName;
-
- /** Age. */
- @QuerySqlField
- private final int age;
-
- /**
- * @param id ID.
- * @param firstName First name.
- * @param lastName Last name.
- * @param age Age.
- */
- private Person(int id, String firstName, String lastName, int age) {
- assert !F.isEmpty(firstName);
- assert !F.isEmpty(lastName);
- assert age > 0;
-
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.age = age;
- }
- }
-}
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index 47a3429c000..c53fa76a04f 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -26,16 +26,7 @@ import org.apache.ignite.internal.jdbc2.JdbcDistributedJoinsQueryTest;
import org.apache.ignite.internal.jdbc2.JdbcSchemaCaseSelfTest;
import org.apache.ignite.jdbc.JdbcAuthorizationTest;
import org.apache.ignite.jdbc.JdbcComplexQuerySelfTest;
-import org.apache.ignite.jdbc.JdbcConnectionSelfTest;
-import org.apache.ignite.jdbc.JdbcDefaultNoOpCacheTest;
-import org.apache.ignite.jdbc.JdbcEmptyCacheSelfTest;
-import org.apache.ignite.jdbc.JdbcMetadataSelfTest;
-import org.apache.ignite.jdbc.JdbcNoDefaultCacheTest;
-import org.apache.ignite.jdbc.JdbcPojoLegacyQuerySelfTest;
import org.apache.ignite.jdbc.JdbcPojoQuerySelfTest;
-import org.apache.ignite.jdbc.JdbcPreparedStatementSelfTest;
-import org.apache.ignite.jdbc.JdbcResultSetSelfTest;
-import org.apache.ignite.jdbc.JdbcStatementSelfTest;
import org.apache.ignite.jdbc.JdbcThinMetadataSqlMatchTest;
import org.apache.ignite.jdbc.thin.JdbcThinAuthenticateConnectionSelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinAutoCloseServerCursorTest;
@@ -112,17 +103,8 @@ import org.junit.runners.Suite;
RunningQueryInfoCheckInitiatorTest.class,
- JdbcConnectionSelfTest.class,
- JdbcStatementSelfTest.class,
- JdbcPreparedStatementSelfTest.class,
- JdbcResultSetSelfTest.class,
JdbcComplexQuerySelfTest.class,
- JdbcMetadataSelfTest.class,
- JdbcEmptyCacheSelfTest.class,
- JdbcNoDefaultCacheTest.class,
- JdbcDefaultNoOpCacheTest.class,
JdbcPojoQuerySelfTest.class,
- JdbcPojoLegacyQuerySelfTest.class,
JdbcConnectionReopenTest.class,
JdbcAuthorizationTest.class,
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
index 9c0948a115f..eed4624c5fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
@@ -23,17 +23,11 @@ import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
-import java.util.Arrays;
-import java.util.List;
import java.util.Properties;
import java.util.logging.Logger;
import org.apache.ignite.cache.affinity.AffinityKey;
-import org.apache.ignite.internal.jdbc.JdbcConnection;
import org.apache.ignite.internal.jdbc.JdbcDriverPropertyInfo;
-
-import static org.apache.ignite.ssl.SslContextFactory.DFLT_KEY_ALGORITHM;
-import static org.apache.ignite.ssl.SslContextFactory.DFLT_SSL_PROTOCOL;
-import static org.apache.ignite.ssl.SslContextFactory.DFLT_STORE_TYPE;
+import org.apache.ignite.internal.jdbc2.JdbcConnection;
/**
* JDBC driver implementation for In-Memory Data Grid.
@@ -73,12 +67,7 @@ import static org.apache.ignite.ssl.SslContextFactory.DFLT_STORE_TYPE;
* you have to add main Ignite JAR will all dependencies to its classpath.
* <h1 class="header">Configuration</h1>
*
- * JDBC driver can return two different types of connection: Ignite Java client based connection and
- * Ignite client node based connection. Java client best connection is deprecated and left only for
- * compatibility with previous version, so you should always use Ignite client node based mode.
- * It is also preferable because it has much better performance.
- *
- * The type of returned connection depends on provided JDBC connection URL.
+ * JDBC driver return Ignite client node based connection.
*
* <h2 class="header">Configuration of Ignite client node based connection</h2>
*
@@ -130,139 +119,9 @@ import static org.apache.ignite.ssl.SslContextFactory.DFLT_STORE_TYPE;
* <p> Defaults to {@code false}, meaning that the whole result set is fetched to memory eagerly.
* </li>
* </ul>
- *
- * <h2 class="header">Configuration of Ignite Java client based connection</h2>
- *
- * All Ignite Java client configuration properties can be applied to JDBC connection of this type.
- * <p>
- * JDBC connection URL has the following pattern:
- * {@code jdbc:ignite://<hostname>:<port>/<cache_name>?nodeId=<UUID>}<br>
- * Note the following:
- * <ul>
- * <li>Hostname is required.</li>
- * <li>If port is not defined, {@code 11211} is used (default for Ignite client).</li>
- * <li>Leave {@code <cache_name>} empty if you are connecting to default cache.</li>
- * <li>
- * Provide {@code nodeId} parameter if you want to specify node where to execute
- * your queries. Note that local and replicated caches will be queried locally on
- * this node while partitioned cache is queried distributively. If node ID is not
- * provided, random node is used. If node with provided ID doesn't exist,
- * exception is thrown.
- * </li>
- * </ul>
- * Other properties can be defined in {@link Properties} object passed to
- * {@link DriverManager#getConnection(String, Properties)} method:
- * <table class="doctable">
- * <tr>
- * <th>Name</th>
- * <th>Description</th>
- * <th>Default</th>
- * <th>Optional</th>
- * </tr>
- * <tr>
- * <td><b>ignite.client.protocol</b></td>
- * <td>Communication protocol ({@code TCP} or {@code HTTP}).</td>
- * <td>{@code TCP}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.connectTimeout</b></td>
- * <td>Socket connection timeout.</td>
- * <td>{@code 0} (infinite timeout)</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.tcp.noDelay</b></td>
- * <td>Flag indicating whether TCP_NODELAY flag should be enabled for outgoing connections.</td>
- * <td>{@code true}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.enabled</b></td>
- * <td>Flag indicating that {@code SSL} is needed for connection.</td>
- * <td>{@code false}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.protocol</b></td>
- * <td>SSL protocol ({@code SSL} or {@code TLS}).</td>
- * <td>{@code TLS}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.key.algorithm</b></td>
- * <td>Key manager algorithm.</td>
- * <td>{@code SunX509}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.keystore.location</b></td>
- * <td>Key store to be used by client to connect with Ignite topology.</td>
- * <td> </td>
- * <td>No (if {@code SSL} is enabled)</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.keystore.password</b></td>
- * <td>Key store password.</td>
- * <td> </td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.keystore.type</b></td>
- * <td>Key store type.</td>
- * <td>{@code jks}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.truststore.location</b></td>
- * <td>Trust store to be used by client to connect with Ignite topology.</td>
- * <td> </td>
- * <td>No (if {@code SSL} is enabled)</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.truststore.password</b></td>
- * <td>Trust store password.</td>
- * <td> </td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.ssl.truststore.type</b></td>
- * <td>Trust store type.</td>
- * <td>{@code jks}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.credentials</b></td>
- * <td>Client credentials used in authentication process.</td>
- * <td> </td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.cache.top</b></td>
- * <td>
- * Flag indicating that topology is cached internally. Cache will be refreshed in
- * the background with interval defined by {@code ignite.client.topology.refresh}
- * property (see below).
- * </td>
- * <td>{@code false}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.topology.refresh</b></td>
- * <td>Topology cache refresh frequency (ms).</td>
- * <td>{@code 2000}</td>
- * <td>Yes</td>
- * </tr>
- * <tr>
- * <td><b>ignite.client.idleTimeout</b></td>
- * <td>Maximum amount of time that connection can be idle before it is closed (ms).</td>
- * <td>{@code 30000}</td>
- * <td>Yes</td>
- * </tr>
- * </table>
* <h1 class="header">Example</h1>
* <pre name="code" class="java">
- * // Open JDBC connection.
+ * // Open JDBC connection.
* Connection conn = DriverManager.getConnection("jdbc:ignite:cfg//cache=persons@file:///etc/configs/ignite-jdbc.xml");
*
* // Query persons' names
@@ -398,9 +257,6 @@ public class IgniteJdbcDriver implements Driver {
/** Cache name property name. */
public static final String PROP_CFG = PROP_PREFIX + "cfg";
- /** URL prefix. */
- public static final String URL_PREFIX = "jdbc:ignite://";
-
/** Config URL prefix. */
public static final String CFG_URL_PREFIX = "jdbc:ignite:cfg://";
@@ -436,19 +292,12 @@ public class IgniteJdbcDriver implements Driver {
if (!parseUrl(url, props))
throw new SQLException("URL is invalid: " + url);
- if (url.startsWith(URL_PREFIX)) {
- if (props.getProperty(PROP_CFG) != null)
- LOG.warning(PROP_CFG + " property is not applicable for this URL.");
-
- return new JdbcConnection(url, props);
- }
- else
- return new org.apache.ignite.internal.jdbc2.JdbcConnection(url, props);
+ return new JdbcConnection(url, props);
}
/** {@inheritDoc} */
@Override public boolean acceptsURL(String url) throws SQLException {
- return url.startsWith(URL_PREFIX) || url.startsWith(CFG_URL_PREFIX);
+ return url.startsWith(CFG_URL_PREFIX);
}
/** {@inheritDoc} */
@@ -456,7 +305,7 @@ public class IgniteJdbcDriver implements Driver {
if (!parseUrl(url, info))
throw new SQLException("URL is invalid: " + url);
- List<DriverPropertyInfo> props = Arrays.<DriverPropertyInfo>asList(
+ return new DriverPropertyInfo[]{
new JdbcDriverPropertyInfo("Hostname", info.getProperty(PROP_HOST), ""),
new JdbcDriverPropertyInfo("Port number", info.getProperty(PROP_PORT), ""),
new JdbcDriverPropertyInfo("Cache name", info.getProperty(PROP_CACHE), ""),
@@ -469,66 +318,9 @@ public class IgniteJdbcDriver implements Driver {
new JdbcDriverPropertyInfo("Transactions Allowed", info.getProperty(PROP_TX_ALLOWED), ""),
new JdbcDriverPropertyInfo("Queries with multiple statements allowed", info.getProperty(PROP_MULTIPLE_STMTS), ""),
new JdbcDriverPropertyInfo("Skip reducer on update", info.getProperty(PROP_SKIP_REDUCER_ON_UPDATE), ""),
- new JdbcDriverPropertyInfo("Schema name", info.getProperty(PROP_SCHEMA), "")
- );
-
- if (info.getProperty(PROP_CFG) != null)
- props.add(new JdbcDriverPropertyInfo("Configuration path", info.getProperty(PROP_CFG), ""));
- else
- props.addAll(Arrays.<DriverPropertyInfo>asList(
- new JdbcDriverPropertyInfo("ignite.client.protocol",
- info.getProperty("ignite.client.protocol", "TCP"),
- "Communication protocol (TCP or HTTP)."),
- new JdbcDriverPropertyInfo("ignite.client.connectTimeout",
- info.getProperty("ignite.client.connectTimeout", "0"),
- "Socket connection timeout."),
- new JdbcDriverPropertyInfo("ignite.client.tcp.noDelay",
- info.getProperty("ignite.client.tcp.noDelay", "true"),
- "Flag indicating whether TCP_NODELAY flag should be enabled for outgoing connections."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.enabled",
- info.getProperty("ignite.client.ssl.enabled", "false"),
- "Flag indicating that SSL is needed for connection."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.protocol",
- info.getProperty("ignite.client.ssl.protocol", DFLT_SSL_PROTOCOL),
- "SSL protocol."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.key.algorithm",
- info.getProperty("ignite.client.ssl.key.algorithm", DFLT_KEY_ALGORITHM),
- "Key manager algorithm."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.location",
- info.getProperty("ignite.client.ssl.keystore.location", ""),
- "Key store to be used by client to connect with Ignite topology."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.password",
- info.getProperty("ignite.client.ssl.keystore.password", ""),
- "Key store password."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.type",
- info.getProperty("ignite.client.ssl.keystore.type", DFLT_STORE_TYPE),
- "Key store type."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.truststore.location",
- info.getProperty("ignite.client.ssl.truststore.location", ""),
- "Trust store to be used by client to connect with Ignite topology."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.keystore.password",
- info.getProperty("ignite.client.ssl.truststore.password", ""),
- "Trust store password."),
- new JdbcDriverPropertyInfo("ignite.client.ssl.truststore.type",
- info.getProperty("ignite.client.ssl.truststore.type", DFLT_STORE_TYPE),
- "Trust store type."),
- new JdbcDriverPropertyInfo("ignite.client.credentials",
- info.getProperty("ignite.client.credentials", ""),
- "Client credentials used in authentication process."),
- new JdbcDriverPropertyInfo("ignite.client.cache.top",
- info.getProperty("ignite.client.cache.top", "false"),
- "Flag indicating that topology is cached internally. Cache will be refreshed in the " +
- "background with interval defined by topologyRefreshFrequency property (see below)."),
- new JdbcDriverPropertyInfo("ignite.client.topology.refresh",
- info.getProperty("ignite.client.topology.refresh", "2000"),
- "Topology cache refresh frequency (ms)."),
- new JdbcDriverPropertyInfo("ignite.client.idleTimeout",
- info.getProperty("ignite.client.idleTimeout", "30000"),
- "Maximum amount of time that connection can be idle before it is closed (ms).")
- )
- );
-
- return props.toArray(new DriverPropertyInfo[0]);
+ new JdbcDriverPropertyInfo("Schema name", info.getProperty(PROP_SCHEMA), ""),
+ new JdbcDriverPropertyInfo("Configuration path", info.getProperty(PROP_CFG), "")
+ };
}
/** {@inheritDoc} */
@@ -562,9 +354,7 @@ public class IgniteJdbcDriver implements Driver {
if (url == null)
return false;
- if (url.startsWith(URL_PREFIX) && url.length() > URL_PREFIX.length())
- return parseJdbcUrl(url, props);
- else if (url.startsWith(CFG_URL_PREFIX) && url.length() >= CFG_URL_PREFIX.length())
+ if (url.startsWith(CFG_URL_PREFIX) && url.length() >= CFG_URL_PREFIX.length())
return parseJdbcConfigUrl(url, props);
return false;
@@ -592,53 +382,6 @@ public class IgniteJdbcDriver implements Driver {
return true;
}
- /**
- * @param url Url.
- * @param props Properties.
- */
- private boolean parseJdbcUrl(String url, Properties props) {
- url = url.substring(URL_PREFIX.length());
-
- String[] parts = url.split("\\?");
-
- if (parts.length > 2)
- return false;
-
- if (parts.length == 2)
- if (!parseParameters(parts[1], "&", props))
- return false;
-
- parts = parts[0].split("/");
-
- assert parts.length > 0;
-
- if (parts.length > 2)
- return false;
-
- if (parts.length == 2 && !parts[1].isEmpty())
- props.setProperty(PROP_CACHE, parts[1]);
-
- url = parts[0];
-
- parts = url.split(":");
-
- assert parts.length > 0;
-
- if (parts.length > 2)
- return false;
-
- props.setProperty(PROP_HOST, parts[0]);
-
- try {
- props.setProperty(PROP_PORT, String.valueOf(parts.length == 2 ? Integer.valueOf(parts[1]) : DFLT_PORT));
- }
- catch (NumberFormatException ignored) {
- return false;
- }
-
- return true;
- }
-
/**
* Validates and parses URL parameters.
*
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcThinDriver.java b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcThinDriver.java
index b6dff88dc8a..3fe30658e8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcThinDriver.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcThinDriver.java
@@ -68,7 +68,7 @@ import org.apache.ignite.internal.jdbc.thin.JdbcThinUtils;
*
* <p>
* JDBC connection URL has the following pattern:
- * {@code jdbc:ignite://<hostname>:<port>/}<br>
+ * {@code jdbc:ignite:thin://<hostname>:<port>/}<br>
* Note the following:
* <ul>
* <li>Hostname is required.</li>
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
deleted file mode 100644
index 3ed53a56741..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * 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.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Savepoint;
-import java.sql.Statement;
-import java.sql.Struct;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-import java.util.UUID;
-import java.util.concurrent.Executor;
-import org.apache.ignite.internal.client.GridClient;
-import org.apache.ignite.internal.client.GridClientConfiguration;
-import org.apache.ignite.internal.client.GridClientDisconnectedException;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.client.GridClientFactory;
-import org.apache.ignite.internal.client.GridClientFutureTimeoutException;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.plugin.security.SecurityCredentials;
-import org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider;
-
-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.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.ignite.IgniteJdbcDriver.PROP_CACHE;
-import static org.apache.ignite.IgniteJdbcDriver.PROP_HOST;
-import static org.apache.ignite.IgniteJdbcDriver.PROP_NODE_ID;
-import static org.apache.ignite.IgniteJdbcDriver.PROP_PORT;
-
-/**
- * JDBC connection implementation.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@Deprecated
-public class JdbcConnection implements Connection {
- /** Connection validation task name. */
- private static final String CONNECTION_VALID_TASK_NAME =
- "org.apache.ignite.internal.jdbc.JdbcConnectionValidationTask";
-
- /** Cache validation task name. */
- private static final String CACHE_VALID_TASK_NAME =
- "org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidationTask";
-
- /** Ignite client. */
- private final GridClient client;
-
- /** Cache name. */
- private String cacheName;
-
- /** Closed flag. */
- private boolean closed;
-
- /** URL. */
- private String url;
-
- /** Node ID. */
- private UUID nodeId;
-
- /** Timeout. */
- private int timeout;
-
- /** Whether using security. */
- private boolean usingSecurity;
-
- /**
- * Creates new connection.
- *
- * @param url Connection URL.
- * @param props Additional properties.
- * @throws SQLException In case Ignite client failed to start.
- */
- public JdbcConnection(String url, Properties props) throws SQLException {
- assert url != null;
- assert props != null;
-
- this.url = url;
- cacheName = props.getProperty(PROP_CACHE);
-
- String nodeIdProp = props.getProperty(PROP_NODE_ID);
-
- if (nodeIdProp != null)
- nodeId = UUID.fromString(nodeIdProp);
-
- try {
- GridClientConfiguration cfg = new GridClientConfiguration(props);
-
- cfg.setServers(Collections.singleton(props.getProperty(PROP_HOST) + ":" + props.getProperty(PROP_PORT)));
-
- String user = props.getProperty("user");
- String passwd = props.getProperty("password");
-
- if (!F.isEmpty(user)) {
- usingSecurity = true;
-
- SecurityCredentials creds = new SecurityCredentials(user, passwd);
-
- cfg.setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(creds));
- }
- else
- usingSecurity = false;
-
- // Disable all fetching and caching for metadata.
- cfg.setEnableMetricsCache(false);
- cfg.setEnableAttributesCache(false);
- cfg.setAutoFetchMetrics(false);
- cfg.setAutoFetchAttributes(false);
-
- client = GridClientFactory.start(cfg);
- }
- catch (GridClientException e) {
- throw new SQLException("Failed to start Ignite client.", e);
- }
-
- if (!isValid(2))
- throw new SQLException("Client is invalid. Probably cache name is wrong.");
- }
-
- /** {@inheritDoc} */
- @Override public Statement createStatement() throws SQLException {
- return createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT);
- }
-
- /** {@inheritDoc} */
- @Override public PreparedStatement prepareStatement(String sql) throws SQLException {
- ensureNotClosed();
-
- return prepareStatement(sql, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT);
- }
-
- /** {@inheritDoc} */
- @Override public CallableStatement prepareCall(String sql) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Callable functions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public String nativeSQL(String sql) throws SQLException {
- ensureNotClosed();
-
- return sql;
- }
-
- /** {@inheritDoc} */
- @Override public void setAutoCommit(boolean autoCommit) throws SQLException {
- ensureNotClosed();
-
- if (!autoCommit)
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public boolean getAutoCommit() throws SQLException {
- ensureNotClosed();
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public void commit() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void rollback() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void close() throws SQLException {
- if (closed)
- return;
-
- closed = true;
-
- GridClientFactory.stop(client.id(), false);
- }
-
- /** {@inheritDoc} */
- @Override public boolean isClosed() throws SQLException {
- return closed;
- }
-
- /** {@inheritDoc} */
- @Override public DatabaseMetaData getMetaData() throws SQLException {
- ensureNotClosed();
-
- return new JdbcDatabaseMetadata(this);
- }
-
- /** {@inheritDoc} */
- @Override public void setReadOnly(boolean readOnly) throws SQLException {
- ensureNotClosed();
-
- if (!readOnly)
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public boolean isReadOnly() throws SQLException {
- ensureNotClosed();
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public void setCatalog(String catalog) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Catalogs are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public String getCatalog() throws SQLException {
- ensureNotClosed();
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void setTransactionIsolation(int level) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public int getTransactionIsolation() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public SQLWarning getWarnings() throws SQLException {
- ensureNotClosed();
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void clearWarnings() throws SQLException {
- ensureNotClosed();
- }
-
- /** {@inheritDoc} */
- @Override public Statement createStatement(int resSetType, int resSetConcurrency) throws SQLException {
- return createStatement(resSetType, resSetConcurrency, HOLD_CURSORS_OVER_COMMIT);
- }
-
- /** {@inheritDoc} */
- @Override public PreparedStatement prepareStatement(String sql, int resSetType,
- int resSetConcurrency) throws SQLException {
- ensureNotClosed();
-
- return prepareStatement(sql, resSetType, resSetConcurrency, HOLD_CURSORS_OVER_COMMIT);
- }
-
- /** {@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 Map<String, Class<?>> getTypeMap() throws SQLException {
- 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)
- throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
- }
-
- /** {@inheritDoc} */
- @Override public int getHoldability() throws SQLException {
- ensureNotClosed();
-
- return HOLD_CURSORS_OVER_COMMIT;
- }
-
- /** {@inheritDoc} */
- @Override public Savepoint setSavepoint() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public Savepoint setSavepoint(String name) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void rollback(Savepoint savepoint) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Transactions are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public Statement createStatement(int resSetType, int resSetConcurrency,
- int resSetHoldability) throws SQLException {
- ensureNotClosed();
-
- 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).");
-
- if (resSetHoldability != HOLD_CURSORS_OVER_COMMIT)
- throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
-
- JdbcStatement stmt = new JdbcStatement(this);
-
- if (timeout > 0)
- stmt.timeout(timeout);
-
- return stmt;
- }
-
- /** {@inheritDoc} */
- @Override public PreparedStatement prepareStatement(String sql, int resSetType, int resSetConcurrency,
- int resSetHoldability) throws SQLException {
- ensureNotClosed();
-
- 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).");
-
- if (resSetHoldability != HOLD_CURSORS_OVER_COMMIT)
- throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
-
- JdbcPreparedStatement stmt = new JdbcPreparedStatement(this, sql);
-
- if (timeout > 0)
- stmt.timeout(timeout);
-
- return stmt;
- }
-
- /** {@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("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public PreparedStatement prepareStatement(String sql, int[] colIndexes) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public PreparedStatement prepareStatement(String sql, String[] colNames) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates 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 {
- ensureNotClosed();
-
- if (timeout < 0)
- throw new SQLException("Invalid timeout: " + timeout);
-
- try {
- return client.compute()
- .<Boolean>executeAsync(usingSecurity ? CONNECTION_VALID_TASK_NAME : CACHE_VALID_TASK_NAME, cacheName)
- .get(timeout, SECONDS);
- }
- catch (GridClientDisconnectedException | GridClientFutureTimeoutException e) {
- throw new SQLException("Failed to establish connection.", e);
- }
- catch (GridClientException ignored) {
- return false;
- }
- }
-
- /** {@inheritDoc} */
- @Override public void setClientInfo(String name, String val) throws SQLClientInfoException {
- throw new UnsupportedOperationException("Client info is not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setClientInfo(Properties props) throws SQLClientInfoException {
- throw new UnsupportedOperationException("Client info is not supported.");
- }
-
- /** {@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();
-
- throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public Struct createStruct(String typeName, Object[] attrs) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
- }
-
- /** {@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 == Connection.class;
- }
-
- /** {@inheritDoc} */
- @Override public void setSchema(String schema) throws SQLException {
- cacheName = schema;
- }
-
- /** {@inheritDoc} */
- @Override public String getSchema() throws SQLException {
- return cacheName;
- }
-
- /** {@inheritDoc} */
- @Override public void abort(Executor executor) throws SQLException {
- close();
- }
-
- /** {@inheritDoc} */
- @Override public void setNetworkTimeout(Executor executor, int ms) throws SQLException {
- if (ms < 0)
- throw new IllegalArgumentException("Timeout is below zero: " + ms);
-
- timeout = ms;
- }
-
- /** {@inheritDoc} */
- @Override public int getNetworkTimeout() throws SQLException {
- return timeout;
- }
-
- /**
- * @return Ignite client.
- */
- GridClient client() {
- return client;
- }
-
- /**
- * @return Cache name.
- */
- String cacheName() {
- return cacheName;
- }
-
- /**
- * @return URL.
- */
- String url() {
- return url;
- }
-
- /**
- * @return Node ID.
- */
- UUID nodeId() {
- return nodeId;
- }
-
- /**
- * Ensures that connection is not closed.
- *
- * @throws SQLException If connection is closed.
- */
- private void ensureNotClosed() throws SQLException {
- if (closed)
- throw new SQLException("Connection is closed.");
- }
-
- /**
- * @return Internal statement.
- * @throws SQLException In case of error.
- */
- JdbcStatement createStatement0() throws SQLException {
- return (JdbcStatement)createStatement();
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnectionValidationTask.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnectionValidationTask.java
deleted file mode 100644
index a3c7248e505..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnectionValidationTask.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.internal.util.typedef.F;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * This task is used for {@link org.apache.ignite.internal.jdbc.JdbcConnection} validation.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@Deprecated
-public class JdbcConnectionValidationTask extends ComputeTaskSplitAdapter<Object, Boolean> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) throws IgniteException {
- return Collections.singletonList(new ComputeJobAdapter() {
- @Override public Object execute() throws IgniteException {
- return true;
- }
- });
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Boolean reduce(List<ComputeJobResult> results) throws IgniteException {
- return F.first(results).getData();
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
deleted file mode 100644
index a8b4650ce17..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
+++ /dev/null
@@ -1,1327 +0,0 @@
-/*
- * 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.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.RowIdLifetime;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-import static java.sql.Connection.TRANSACTION_NONE;
-import static java.sql.ResultSet.CONCUR_READ_ONLY;
-import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
-import static java.sql.RowIdLifetime.ROWID_UNSUPPORTED;
-
-/**
- * JDBC database metadata implementation.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@SuppressWarnings("RedundantCast")
-@Deprecated
-public class JdbcDatabaseMetadata implements DatabaseMetaData {
- /** Task name. */
- private static final String TASK_NAME =
- "org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcMetadataTask";
-
- /** Connection. */
- private final JdbcConnection conn;
-
- /** Metadata. */
- private Map<String, Map<String, Map<String, String>>> meta;
-
- /** Index info. */
- private Collection<List<Object>> indexes;
-
- /**
- * @param conn Connection.
- */
- JdbcDatabaseMetadata(JdbcConnection conn) {
- this.conn = conn;
- }
-
- /** {@inheritDoc} */
- @Override public boolean allProceduresAreCallable() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean allTablesAreSelectable() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public String getURL() throws SQLException {
- return conn.url();
- }
-
- /** {@inheritDoc} */
- @Override public String getUserName() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public boolean isReadOnly() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean nullsAreSortedHigh() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean nullsAreSortedLow() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean nullsAreSortedAtStart() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean nullsAreSortedAtEnd() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public String getDatabaseProductName() throws SQLException {
- return "Apache Ignite";
- }
-
- /** {@inheritDoc} */
- @Override public String getDatabaseProductVersion() throws SQLException {
- return "4.1.0";
- }
-
- /** {@inheritDoc} */
- @Override public String getDriverName() throws SQLException {
- return "Ignite JDBC Driver";
- }
-
- /** {@inheritDoc} */
- @Override public String getDriverVersion() throws SQLException {
- return "1.0";
- }
-
- /** {@inheritDoc} */
- @Override public int getDriverMajorVersion() {
- return 1;
- }
-
- /** {@inheritDoc} */
- @Override public int getDriverMinorVersion() {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public boolean usesLocalFiles() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean usesLocalFilePerTable() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsMixedCaseIdentifiers() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean storesUpperCaseIdentifiers() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean storesLowerCaseIdentifiers() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean storesMixedCaseIdentifiers() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public String getIdentifierQuoteString() throws SQLException {
- return " ";
- }
-
- /** {@inheritDoc} */
- @Override public String getSQLKeywords() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getNumericFunctions() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getStringFunctions() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getSystemFunctions() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getTimeDateFunctions() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getSearchStringEscape() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getExtraNameCharacters() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsAlterTableWithAddColumn() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsAlterTableWithDropColumn() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsColumnAliasing() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean nullPlusNonNullIsNull() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsConvert() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsConvert(int fromType, int toType) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsTableCorrelationNames() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsDifferentTableCorrelationNames() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsExpressionsInOrderBy() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsOrderByUnrelated() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsGroupBy() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsGroupByUnrelated() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsGroupByBeyondSelect() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsLikeEscapeClause() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsMultipleResultSets() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsMultipleTransactions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsNonNullableColumns() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsMinimumSQLGrammar() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsCoreSQLGrammar() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsExtendedSQLGrammar() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsANSI92EntryLevelSQL() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsANSI92IntermediateSQL() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsANSI92FullSQL() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsIntegrityEnhancementFacility() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsOuterJoins() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsFullOuterJoins() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsLimitedOuterJoins() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public String getSchemaTerm() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getProcedureTerm() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public String getCatalogTerm() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public boolean isCatalogAtStart() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public String getCatalogSeparator() throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSchemasInDataManipulation() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSchemasInProcedureCalls() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSchemasInTableDefinitions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSchemasInIndexDefinitions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsCatalogsInDataManipulation() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsCatalogsInProcedureCalls() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsCatalogsInTableDefinitions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsPositionedDelete() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsPositionedUpdate() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSelectForUpdate() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsStoredProcedures() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSubqueriesInComparisons() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSubqueriesInExists() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSubqueriesInIns() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSubqueriesInQuantifieds() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsCorrelatedSubqueries() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsUnion() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsUnionAll() throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxBinaryLiteralLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxCharLiteralLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxColumnNameLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxColumnsInGroupBy() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxColumnsInIndex() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxColumnsInOrderBy() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxColumnsInSelect() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxColumnsInTable() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxConnections() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxCursorNameLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxIndexLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxSchemaNameLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxProcedureNameLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxCatalogNameLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxRowSize() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxStatementLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxStatements() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxTableNameLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxTablesInSelect() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxUserNameLength() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getDefaultTransactionIsolation() throws SQLException {
- return TRANSACTION_NONE;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsTransactions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getProcedures(String catalog, String schemaPtrn,
- String procedureNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("PROCEDURE_CAT", "PROCEDURE_SCHEM", "PROCEDURE_NAME",
- "REMARKS", "PROCEDURE_TYPE", "SPECIFIC_NAME"),
- Arrays.<String>asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), Short.class.getName(), String.class.getName()),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getProcedureColumns(String catalog, String schemaPtrn, String procedureNamePtrn,
- String colNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("PROCEDURE_CAT", "PROCEDURE_SCHEM", "PROCEDURE_NAME",
- "COLUMN_NAME", "COLUMN_TYPE", "DATA_TYPE", "TYPE_NAME", "PRECISION",
- "LENGTH", "SCALE", "RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF",
- "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH",
- "ORDINAL_POSITION", "IS_NULLABLE", "SPECIFIC_NAME"),
- Arrays.<String>asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), Short.class.getName(), Integer.class.getName(), String.class.getName(),
- Integer.class.getName(), Integer.class.getName(), Short.class.getName(), Short.class.getName(),
- Short.class.getName(), String.class.getName(), String.class.getName(), Integer.class.getName(),
- Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
- String.class.getName()),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn,
- String[] tblTypes) throws SQLException {
- updateMetaData();
-
- List<List<Object>> rows = new LinkedList<>();
-
- if (tblTypes == null || Arrays.asList(tblTypes).contains("TABLE"))
- for (Map.Entry<String, Map<String, Map<String, String>>> schema : meta.entrySet())
- if (matches(schema.getKey(), schemaPtrn))
- for (String tbl : schema.getValue().keySet())
- if (matches(tbl, tblNamePtrn))
- rows.add(tableRow(schema.getKey(), tbl));
-
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS", "TYPE_CAT",
- "TYPE_SCHEM", "TYPE_NAME", "SELF_REFERENCING_COL_NAME", "REF_GENERATION"),
- Arrays.<String>asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), String.class.getName(), String.class.getName()),
- rows
- );
- }
-
- /**
- * @param schema Schema name.
- * @param tbl Table name.
- * @return Table metadata row.
- */
- private List<Object> tableRow(String schema, String tbl) {
- List<Object> row = new ArrayList<>(10);
-
- row.add((String)null);
- row.add(schema);
- row.add(tbl.toUpperCase());
- row.add("TABLE");
- row.add((String)null);
- row.add((String)null);
- row.add((String)null);
- row.add((String)null);
- row.add((String)null);
- row.add((String)null);
-
- return row;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getSchemas() throws SQLException {
- return getSchemas(null, "%");
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getCatalogs() throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("TABLE_CAT"),
- Arrays.<String>asList(String.class.getName()),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getTableTypes() throws SQLException {
- return new JdbcResultSet(conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.singletonList("TABLE_TYPE"),
- Collections.<String>singletonList(String.class.getName()),
- Collections.singletonList(Collections.<Object>singletonList("TABLE")));
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getColumns(String catalog, String schemaPtrn, String tblNamePtrn,
- String colNamePtrn) throws SQLException {
- updateMetaData();
-
- List<List<Object>> rows = new LinkedList<>();
-
- int cnt = 0;
-
- for (Map.Entry<String, Map<String, Map<String, String>>> schema : meta.entrySet())
- if (matches(schema.getKey(), schemaPtrn))
- for (Map.Entry<String, Map<String, String>> tbl : schema.getValue().entrySet())
- if (matches(tbl.getKey(), tblNamePtrn))
- for (Map.Entry<String, String> col : tbl.getValue().entrySet())
- rows.add(columnRow(schema.getKey(), tbl.getKey(), col.getKey(),
- JdbcUtils.type(col.getValue()), JdbcUtils.typeName(col.getValue()),
- JdbcUtils.nullable(col.getKey(), col.getValue()), ++cnt));
-
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE",
- "TYPE_NAME", "COLUMN_SIZE", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE",
- "REMARKS", "COLUMN_DEF", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE",
- "SCOPE_CATLOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT"),
- Arrays.<String>asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), Integer.class.getName(), String.class.getName(), Integer.class.getName(),
- Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
- String.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
- String.class.getName(), String.class.getName(), String.class.getName(), Short.class.getName(),
- String.class.getName()),
- rows
- );
- }
-
- /**
- * @param schema Schema name.
- * @param tbl Table name.
- * @param col Column name.
- * @param type Type.
- * @param typeName Type name.
- * @param nullable Nullable flag.
- * @param pos Ordinal position.
- * @return Column metadata row.
- */
- private List<Object> columnRow(String schema, String tbl, String col, int type, String typeName,
- boolean nullable, int pos) {
- List<Object> row = new ArrayList<>(20);
-
- row.add((String)null);
- row.add(schema);
- row.add(tbl);
- row.add(col);
- row.add(type);
- row.add(typeName);
- row.add((Integer)null);
- row.add((Integer)null);
- row.add(10);
- row.add(nullable ? columnNullable : columnNoNulls);
- row.add((String)null);
- row.add((String)null);
- row.add(Integer.MAX_VALUE);
- row.add(pos);
- row.add("YES");
- row.add((String)null);
- row.add((String)null);
- row.add((String)null);
- row.add((Short)null);
- row.add("NO");
-
- return row;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getColumnPrivileges(String catalog, String schema, String tbl,
- String colNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getTablePrivileges(String catalog, String schemaPtrn,
- String tblNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getBestRowIdentifier(String catalog, String schema, String tbl, int scope,
- boolean nullable) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getVersionColumns(String catalog, String schema, String tbl) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getPrimaryKeys(String catalog, String schema, String tbl) throws SQLException {
- updateMetaData();
-
- List<List<Object>> rows = new LinkedList<>();
-
- for (Map.Entry<String, Map<String, Map<String, String>>> s : meta.entrySet())
- if (schema == null || schema.toUpperCase().equals(s.getKey()))
- for (Map.Entry<String, Map<String, String>> t : s.getValue().entrySet())
- if (tbl == null || tbl.toUpperCase().equals(t.getKey()))
- rows.add(Arrays.<Object>asList((String)null, s.getKey().toUpperCase(),
- t.getKey().toUpperCase(), "_KEY", 1, "_KEY"));
-
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ", "PK_NAME"),
- Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), Short.class.getName(), String.class.getName()),
- rows
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getImportedKeys(String catalog, String schema, String tbl) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getExportedKeys(String catalog, String schema, String tbl) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTbl,
- String foreignCatalog, String foreignSchema, String foreignTbl) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getTypeInfo() throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getIndexInfo(String catalog, String schema, String tbl, boolean unique,
- boolean approximate) throws SQLException {
- Collection<List<Object>> rows = new ArrayList<>(indexes.size());
-
- for (List<Object> idx : indexes) {
- String idxSchema = (String)idx.get(0);
- String idxTbl = (String)idx.get(1);
-
- if ((schema == null || schema.equals(idxSchema)) && (tbl == null || tbl.equals(idxTbl))) {
- List<Object> row = new ArrayList<>(13);
-
- row.add((String)null);
- row.add(idxSchema);
- row.add(idxTbl);
- row.add((Boolean)idx.get(2));
- row.add((String)null);
- row.add((String)idx.get(3));
- row.add((int)tableIndexOther);
- row.add((Integer)idx.get(4));
- row.add((String)idx.get(5));
- row.add((Boolean)idx.get(6) ? "D" : "A");
- row.add(0);
- row.add(0);
- row.add((String)null);
-
- rows.add(row);
- }
- }
-
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER",
- "INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", "ASC_OR_DESC", "CARDINALITY",
- "PAGES", "FILTER_CONDITION"),
- Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
- Boolean.class.getName(), String.class.getName(), String.class.getName(), Short.class.getName(),
- Short.class.getName(), String.class.getName(), String.class.getName(), Integer.class.getName(),
- Integer.class.getName(), String.class.getName()),
- rows
- );
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsResultSetType(int type) throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
- return concurrency == CONCUR_READ_ONLY;
- }
-
- /** {@inheritDoc} */
- @Override public boolean ownUpdatesAreVisible(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean ownDeletesAreVisible(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean ownInsertsAreVisible(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean othersUpdatesAreVisible(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean othersDeletesAreVisible(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean othersInsertsAreVisible(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean updatesAreDetected(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean deletesAreDetected(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean insertsAreDetected(int type) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsBatchUpdates() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getUDTs(String catalog, String schemaPtrn, String typeNamePtrn,
- int[] types) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public Connection getConnection() throws SQLException {
- return conn;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsSavepoints() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsNamedParameters() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsMultipleOpenResults() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsGetGeneratedKeys() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getSuperTypes(String catalog, String schemaPtrn,
- String typeNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getSuperTables(String catalog, String schemaPtrn,
- String tblNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getAttributes(String catalog, String schemaPtrn, String typeNamePtrn,
- String attributeNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsResultSetHoldability(int holdability) throws SQLException {
- return holdability == HOLD_CURSORS_OVER_COMMIT;
- }
-
- /** {@inheritDoc} */
- @Override public int getResultSetHoldability() throws SQLException {
- return HOLD_CURSORS_OVER_COMMIT;
- }
-
- /** {@inheritDoc} */
- @Override public int getDatabaseMajorVersion() throws SQLException {
- return 1;
- }
-
- /** {@inheritDoc} */
- @Override public int getDatabaseMinorVersion() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getJDBCMajorVersion() throws SQLException {
- return 1;
- }
-
- /** {@inheritDoc} */
- @Override public int getJDBCMinorVersion() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getSQLStateType() throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public boolean locatorsUpdateCopy() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsStatementPooling() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public RowIdLifetime getRowIdLifetime() throws SQLException {
- return ROWID_UNSUPPORTED;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getSchemas(String catalog, String schemaPtrn) throws SQLException {
- updateMetaData();
-
- List<List<Object>> rows = new ArrayList<>(meta.size());
-
- for (String schema : meta.keySet())
- if (matches(schema, schemaPtrn))
- rows.add(Arrays.<Object>asList(schema, (String)null));
-
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("TABLE_SCHEM", "TABLE_CATALOG"),
- Arrays.<String>asList(String.class.getName(), String.class.getName()),
- rows
- );
- }
-
- /** {@inheritDoc} */
- @Override public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getClientInfoProperties() throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getFunctions(String catalog, String schemaPtrn,
- String functionNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME",
- "REMARKS", "FUNCTION_TYPE", "SPECIFIC_NAME"),
- Arrays.<String>asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), Short.class.getName(), String.class.getName()),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getFunctionColumns(String catalog, String schemaPtrn, String functionNamePtrn,
- String colNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Arrays.asList("FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME",
- "COLUMN_NAME", "COLUMN_TYPE", "DATA_TYPE", "TYPE_NAME", "PRECISION",
- "LENGTH", "SCALE", "RADIX", "NULLABLE", "REMARKS", "CHAR_OCTET_LENGTH",
- "ORDINAL_POSITION", "IS_NULLABLE", "SPECIFIC_NAME"),
- Arrays.<String>asList(String.class.getName(), String.class.getName(), String.class.getName(),
- String.class.getName(), Short.class.getName(), Integer.class.getName(), String.class.getName(),
- Integer.class.getName(), Integer.class.getName(), Short.class.getName(), Short.class.getName(),
- Short.class.getName(), String.class.getName(), Integer.class.getName(), Integer.class.getName(),
- String.class.getName(), String.class.getName()),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public <T> T unwrap(Class<T> iface) throws SQLException {
- if (!isWrapperFor(iface))
- throw new SQLException("Database meta data is not a wrapper for " + iface.getName());
-
- return (T)this;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
- return iface != null && iface == DatabaseMetaData.class;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getPseudoColumns(String catalog, String schemaPtrn, String tblNamePtrn,
- String colNamePtrn) throws SQLException {
- return new JdbcResultSet(
- conn.createStatement0(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<String>emptyList(),
- Collections.<List<Object>>emptyList()
- );
- }
-
- /** {@inheritDoc} */
- @Override public boolean generatedKeyAlwaysReturned() throws SQLException {
- return false;
- }
-
- /**
- * Updates meta data.
- *
- * @throws SQLException In case of error.
- */
- private void updateMetaData() throws SQLException {
- if (conn.isClosed())
- throw new SQLException("Connection is closed.");
-
- try {
- byte[] packet = conn.client().compute().execute(TASK_NAME, conn.cacheName());
-
- byte status = packet[0];
- byte[] data = new byte[packet.length - 1];
-
- U.arrayCopy(packet, 1, data, 0, data.length);
-
- if (status == 1)
- throw JdbcUtils.unmarshalError(data);
- else {
- List<Object> res = JdbcUtils.unmarshal(data);
-
- meta = (Map<String, Map<String, Map<String, String>>>)res.get(0);
- indexes = (Collection<List<Object>>)res.get(1);
- }
- }
- catch (GridClientException e) {
- throw new SQLException("Failed to get meta data from Ignite.", e);
- }
- }
-
- /**
- * Checks whether string matches SQL pattern.
- *
- * @param str String.
- * @param ptrn Pattern.
- * @return Whether string matches pattern.
- */
- private boolean matches(String str, String ptrn) {
- return str != null && (ptrn == null ||
- str.toUpperCase().matches(ptrn.toUpperCase().replace("%", ".*").replace("_", ".")));
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
deleted file mode 100644
index e100482b878..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
- * 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.Calendar;
-
-/**
- * JDBC prepared statement implementation.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@Deprecated
-public class JdbcPreparedStatement extends JdbcStatement implements PreparedStatement {
- /** SQL query. */
- private final String sql;
-
- /** Arguments count. */
- private final int argsCnt;
-
- /**
- * Creates new prepared statement.
- *
- * @param conn Connection.
- * @param sql SQL query.
- */
- JdbcPreparedStatement(JdbcConnection conn, String sql) {
- super(conn);
-
- this.sql = sql;
-
- argsCnt = sql.replaceAll("[^?]", "").length();
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet executeQuery() throws SQLException {
- return executeQuery(sql);
- }
-
- /** {@inheritDoc} */
- @Override public int executeUpdate() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@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 length) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Streams are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setUnicodeStream(int paramIdx, InputStream x, int length) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Streams are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setBinaryStream(int paramIdx, InputStream x, int length) 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);
- }
-
- /** {@inheritDoc} */
- @Override public void setObject(int paramIdx, Object x) throws SQLException {
- setArgument(paramIdx, x);
- }
-
- /** {@inheritDoc} */
- @Override public boolean execute() throws SQLException {
- return execute(sql);
- }
-
- /** {@inheritDoc} */
- @Override public void addBatch() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setCharacterStream(int paramIdx, Reader x, int length) 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 {
- setArgument(paramIdx, x);
- }
-
- /** {@inheritDoc} */
- @Override public ParameterMetaData getParameterMetaData() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Meta data for prepared statement is 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();
-
- throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setNCharacterStream(int paramIdx, Reader val, long length) 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 length) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setBlob(int paramIdx, InputStream inputStream, long length) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setNClob(int paramIdx, Reader reader, long length) 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 scaleOrLength) throws SQLException {
- setArgument(paramIdx, x);
- }
-
- /** {@inheritDoc} */
- @Override public void setAsciiStream(int paramIdx, InputStream x, long length) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Streams are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setBinaryStream(int paramIdx, InputStream x, long length) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Streams are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void setCharacterStream(int paramIdx, Reader x, long length) 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.");
- }
-
- /**
- * 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 || paramIdx > argsCnt)
- throw new SQLException("Parameter index is invalid: " + paramIdx);
-
- if (args == null)
- args = new Object[argsCnt];
-
- args[paramIdx - 1] = val;
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
deleted file mode 100644
index c744daa0082..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
+++ /dev/null
@@ -1,1548 +0,0 @@
-/*
- * 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.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.util.Calendar;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.internal.client.GridClientCompute;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-/**
- * JDBC result set implementation.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@Deprecated
-public class JdbcResultSet implements ResultSet {
- /** Task name. */
- private static final String TASK_NAME =
- "org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask";
-
- /** Statement. */
- private final JdbcStatement stmt;
-
- /** Node ID. */
- private final UUID nodeId;
-
- /** Future ID. */
- private final UUID futId;
-
- /** Table names. */
- private final List<String> tbls;
-
- /** Column names. */
- private final List<String> cols;
-
- /** Class names. */
- private final List<String> types;
-
- /** Fields iterator. */
- private Iterator<List<Object>> fields;
-
- /** Finished flag. */
- private boolean finished;
-
- /** Current position. */
- private int pos;
-
- /** Current. */
- private List<Object> curr;
-
- /** Closed flag. */
- private boolean closed;
-
- /** Was {@code NULL} flag. */
- private boolean wasNull;
-
- /** Fetch size. */
- private int fetchSize;
-
- /**
- * Creates new result set.
- *
- * @param stmt Statement.
- * @param nodeId Node ID.
- * @param futId Future ID.
- * @param tbls Table names.
- * @param cols Column names.
- * @param types Types.
- * @param fields Fields.
- * @param finished Finished flag.
- * @param fetchSize Fetch size.
- */
- JdbcResultSet(JdbcStatement stmt, UUID nodeId, UUID futId,
- List<String> tbls, List<String> cols, List<String> types,
- Collection<List<Object>> fields, boolean finished, int fetchSize) {
- assert stmt != null;
- assert nodeId != null;
- assert futId != null;
- assert tbls != null;
- assert cols != null;
- assert types != null;
- assert fields != null;
- assert fetchSize > 0;
-
- this.stmt = stmt;
- this.nodeId = nodeId;
- this.futId = futId;
- this.tbls = tbls;
- this.cols = cols;
- this.types = types;
- this.fetchSize = fetchSize;
- this.fields = fields.iterator();
- this.finished = finished;
- }
-
- /**
- * Creates new result set with predefined fields.
- * Result set created with this constructor will
- * never execute remote tasks.
- *
- * @param stmt Statement.
- * @param tbls Table names.
- * @param cols Column names.
- * @param types Types.
- * @param fields Fields.
- */
- JdbcResultSet(JdbcStatement stmt, List<String> tbls, List<String> cols,
- List<String> types, Collection<List<Object>> fields) {
- assert stmt != null;
- assert tbls != null;
- assert cols != null;
- assert types != null;
- assert fields != null;
-
- this.stmt = stmt;
- this.tbls = tbls;
- this.cols = cols;
- this.types = types;
- this.fields = fields.iterator();
-
- nodeId = null;
- futId = null;
-
- // Prevent task execution.
- finished = true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean next() throws SQLException {
- ensureNotClosed();
-
- if (fields == null && !finished) {
- assert nodeId != null;
- assert futId != null;
-
- try {
- GridClientCompute compute = stmt.connection().client().compute();
-
- GridClientCompute prj = compute.projection(compute.node(nodeId));
-
- byte[] packet = prj.execute(TASK_NAME, JdbcUtils.marshalArgument(
- JdbcUtils.taskArgument(nodeId, futId, fetchSize, stmt.getMaxRows())));
-
- byte status = packet[0];
- byte[] data = new byte[packet.length - 1];
-
- U.arrayCopy(packet, 1, data, 0, data.length);
-
- if (status == 1)
- throw JdbcUtils.unmarshalError(data);
- else {
- List<?> msg = JdbcUtils.unmarshal(data);
-
- assert msg.size() == 2;
-
- fields = ((Collection<List<Object>>)msg.get(0)).iterator();
- finished = (Boolean)msg.get(1);
- }
- }
- catch (GridClientException e) {
- throw new SQLException("Failed to query Ignite.", e);
- }
- }
-
- if (fields != null && fields.hasNext()) {
- curr = fields.next();
-
- if (!fields.hasNext())
- fields = null;
-
- pos++;
-
- return true;
- }
- else {
- curr = null;
-
- return false;
- }
- }
-
- /** {@inheritDoc} */
- @Override public void close() throws SQLException {
- closed = true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean wasNull() throws SQLException {
- return wasNull;
- }
-
- /** {@inheritDoc} */
- @Override public String getString(int colIdx) throws SQLException {
- return getTypedValue(colIdx, String.class);
- }
-
- /** {@inheritDoc} */
- @Override public boolean getBoolean(int colIdx) throws SQLException {
- Boolean val = getTypedValue(colIdx, Boolean.class);
-
- return val != null ? val : false;
- }
-
- /** {@inheritDoc} */
- @Override public byte getByte(int colIdx) throws SQLException {
- Byte val = getTypedValue(colIdx, Byte.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public short getShort(int colIdx) throws SQLException {
- Short val = getTypedValue(colIdx, Short.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getInt(int colIdx) throws SQLException {
- Integer val = getTypedValue(colIdx, Integer.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public long getLong(int colIdx) throws SQLException {
- Long val = getTypedValue(colIdx, Long.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getFloat(int colIdx) throws SQLException {
- Float val = getTypedValue(colIdx, Float.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public double getDouble(int colIdx) throws SQLException {
- Double val = getTypedValue(colIdx, Double.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public BigDecimal getBigDecimal(int colIdx, int scale) throws SQLException {
- return getTypedValue(colIdx, BigDecimal.class);
- }
-
- /** {@inheritDoc} */
- @Override public byte[] getBytes(int colIdx) throws SQLException {
- return getTypedValue(colIdx, byte[].class);
- }
-
- /** {@inheritDoc} */
- @Override public Date getDate(int colIdx) throws SQLException {
- return getTypedValue(colIdx, Date.class);
- }
-
- /** {@inheritDoc} */
- @Override public Time getTime(int colIdx) throws SQLException {
- return getTypedValue(colIdx, Time.class);
- }
-
- /** {@inheritDoc} */
- @Override public Timestamp getTimestamp(int colIdx) throws SQLException {
- return getTypedValue(colIdx, Timestamp.class);
- }
-
- /** {@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 {
- return getTypedValue(colLb, String.class);
- }
-
- /** {@inheritDoc} */
- @Override public boolean getBoolean(String colLb) throws SQLException {
- Boolean val = getTypedValue(colLb, Boolean.class);
-
- return val != null ? val : false;
- }
-
- /** {@inheritDoc} */
- @Override public byte getByte(String colLb) throws SQLException {
- Byte val = getTypedValue(colLb, Byte.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public short getShort(String colLb) throws SQLException {
- Short val = getTypedValue(colLb, Short.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getInt(String colLb) throws SQLException {
- Integer val = getTypedValue(colLb, Integer.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public long getLong(String colLb) throws SQLException {
- Long val = getTypedValue(colLb, Long.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public float getFloat(String colLb) throws SQLException {
- Float val = getTypedValue(colLb, Float.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public double getDouble(String colLb) throws SQLException {
- Double val = getTypedValue(colLb, Double.class);
-
- return val != null ? val : 0;
- }
-
- /** {@inheritDoc} */
- @Override public BigDecimal getBigDecimal(String colLb, int scale) throws SQLException {
- return getTypedValue(colLb, BigDecimal.class);
- }
-
- /** {@inheritDoc} */
- @Override public byte[] getBytes(String colLb) throws SQLException {
- return getTypedValue(colLb, byte[].class);
- }
-
- /** {@inheritDoc} */
- @Override public Date getDate(String colLb) throws SQLException {
- return getTypedValue(colLb, Date.class);
- }
-
- /** {@inheritDoc} */
- @Override public Time getTime(String colLb) throws SQLException {
- return getTypedValue(colLb, Time.class);
- }
-
- /** {@inheritDoc} */
- @Override public Timestamp getTimestamp(String colLb) throws SQLException {
- return getTypedValue(colLb, Timestamp.class);
- }
-
- /** {@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();
-
- return new JdbcResultSetMetadata(tbls, cols, types);
- }
-
- /** {@inheritDoc} */
- @Override public Object getObject(int colIdx) throws SQLException {
- return getTypedValue(colIdx, Object.class);
- }
-
- /** {@inheritDoc} */
- @Override public Object getObject(String colLb) throws SQLException {
- return getTypedValue(colLb, Object.class);
- }
-
- /** {@inheritDoc} */
- @Override public int findColumn(String colLb) throws SQLException {
- ensureNotClosed();
-
- int idx = cols.indexOf(colLb.toUpperCase());
-
- if (idx == -1)
- throw new SQLException("Column not found: " + colLb);
-
- return idx + 1;
- }
-
- /** {@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 {
- return getTypedValue(colIdx, BigDecimal.class);
- }
-
- /** {@inheritDoc} */
- @Override public BigDecimal getBigDecimal(String colLb) throws SQLException {
- return getTypedValue(colLb, BigDecimal.class);
- }
-
- /** {@inheritDoc} */
- @Override public boolean isBeforeFirst() throws SQLException {
- ensureNotClosed();
-
- return pos < 1;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isAfterLast() throws SQLException {
- ensureNotClosed();
-
- return finished && fields == null && curr == null;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isFirst() throws SQLException {
- ensureNotClosed();
-
- return pos == 1;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isLast() throws SQLException {
- ensureNotClosed();
-
- return finished && fields == null && curr != 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 : pos;
- }
-
- /** {@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();
- }
-
- /** {@inheritDoc} */
- @Override public void moveToInsertRow() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void moveToCurrentRow() throws SQLException {
- ensureNotClosed();
- }
-
- /** {@inheritDoc} */
- @Override public Statement getStatement() throws SQLException {
- ensureNotClosed();
-
- return stmt;
- }
-
- /** {@inheritDoc} */
- @Override public Object getObject(int colIdx, Map<String, Class<?>> map) throws SQLException {
- return getTypedValue(colIdx, Object.class);
- }
-
- /** {@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 {
- return getTypedValue(colLb, Object.class);
- }
-
- /** {@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 getTypedValue(colIdx, Date.class);
- }
-
- /** {@inheritDoc} */
- @Override public Date getDate(String colLb, Calendar cal) throws SQLException {
- return getTypedValue(colLb, Date.class);
- }
-
- /** {@inheritDoc} */
- @Override public Time getTime(int colIdx, Calendar cal) throws SQLException {
- return getTypedValue(colIdx, Time.class);
- }
-
- /** {@inheritDoc} */
- @Override public Time getTime(String colLb, Calendar cal) throws SQLException {
- return getTypedValue(colLb, Time.class);
- }
-
- /** {@inheritDoc} */
- @Override public Timestamp getTimestamp(int colIdx, Calendar cal) throws SQLException {
- return getTypedValue(colIdx, Timestamp.class);
- }
-
- /** {@inheritDoc} */
- @Override public Timestamp getTimestamp(String colLb, Calendar cal) throws SQLException {
- return getTypedValue(colLb, Timestamp.class);
- }
-
- /** {@inheritDoc} */
- @Override public URL getURL(int colIdx) throws SQLException {
- return getTypedValue(colIdx, URL.class);
- }
-
- /** {@inheritDoc} */
- @Override public URL getURL(String colLb) throws SQLException {
- return getTypedValue(colLb, URL.class);
- }
-
- /** {@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;
- }
-
- /** {@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 {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public String getNString(String colLb) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
- }
-
- /** {@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 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 == ResultSet.class;
- }
-
- /** {@inheritDoc} */
- @Override public <T> T getObject(int colIdx, Class<T> type) throws SQLException {
- return getTypedValue(colIdx, type);
- }
-
- /** {@inheritDoc} */
- @Override public <T> T getObject(String colLb, Class<T> type) throws SQLException {
- return getTypedValue(colLb, type);
- }
-
- /**
- * Gets casted field value by label.
- *
- * @param colLb Column label.
- * @param cls Value class.
- * @return Casted field value.
- * @throws SQLException In case of error.
- */
- private <T> T getTypedValue(String colLb, Class<T> cls) throws SQLException {
- ensureNotClosed();
- ensureHasCurrentRow();
-
- int colIdx = cols.indexOf(colLb.toUpperCase()) + 1;
-
- if (colIdx <= 0)
- throw new SQLException("Invalid column label: " + colLb);
-
- return getTypedValue(colIdx, cls);
- }
-
- /**
- * Gets casted field value by index.
- *
- * @param colIdx Column index.
- * @param cls Value class.
- * @return Casted field value.
- * @throws SQLException In case of error.
- */
- private <T> T getTypedValue(int colIdx, Class<T> cls) throws SQLException {
- ensureNotClosed();
- ensureHasCurrentRow();
-
- try {
- Object val = curr.get(colIdx - 1);
-
- wasNull = val == null;
-
- if (val == null)
- return null;
- else if (cls == String.class)
- return (T)String.valueOf(val);
- else
- return (T)val;
- }
- catch (IndexOutOfBoundsException ignored) {
- throw new SQLException("Invalid column index: " + colIdx);
- }
- catch (ClassCastException ignored) {
- throw new SQLException("Cannot convert to " + cls.getSimpleName().toLowerCase());
- }
- }
-
- /**
- * 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.");
- }
-
- /**
- * 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 (curr == null)
- throw new SQLException("Result set is not positioned on a row.");
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java
deleted file mode 100644
index 692041b7a77..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.List;
-
-/**
- * JDBC result set metadata implementation.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@Deprecated
-public class JdbcResultSetMetadata implements ResultSetMetaData {
- /** Column width. */
- private static final int COL_WIDTH = 30;
-
- /** Table names. */
- private final List<String> tbls;
-
- /** Column names. */
- private final List<String> cols;
-
- /** Class names. */
- private final List<String> types;
-
- /**
- * @param tbls Table names.
- * @param cols Column names.
- * @param types Types.
- */
- JdbcResultSetMetadata(List<String> tbls, List<String> cols, List<String> types) {
- assert cols != null;
- assert types != null;
-
- this.tbls = tbls;
- this.cols = cols;
- this.types = types;
- }
-
- /** {@inheritDoc} */
- @Override public int getColumnCount() throws SQLException {
- return cols.size();
- }
-
- /** {@inheritDoc} */
- @Override public boolean isAutoIncrement(int col) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isCaseSensitive(int col) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isSearchable(int col) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isCurrency(int col) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public int isNullable(int col) throws SQLException {
- return columnNullable;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isSigned(int col) throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int getColumnDisplaySize(int col) throws SQLException {
- return COL_WIDTH;
- }
-
- /** {@inheritDoc} */
- @Override public String getColumnLabel(int col) throws SQLException {
- return cols.get(col - 1);
- }
-
- /** {@inheritDoc} */
- @Override public String getColumnName(int col) throws SQLException {
- return cols.get(col - 1);
- }
-
- /** {@inheritDoc} */
- @Override public String getSchemaName(int col) throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public int getPrecision(int col) throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public int getScale(int col) throws SQLException {
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public String getTableName(int col) throws SQLException {
- return tbls != null ? tbls.get(col - 1) : "";
- }
-
- /** {@inheritDoc} */
- @Override public String getCatalogName(int col) throws SQLException {
- return "";
- }
-
- /** {@inheritDoc} */
- @Override public int getColumnType(int col) throws SQLException {
- return JdbcUtils.type(types.get(col - 1));
- }
-
- /** {@inheritDoc} */
- @Override public String getColumnTypeName(int col) throws SQLException {
- return JdbcUtils.typeName(types.get(col - 1));
- }
-
- /** {@inheritDoc} */
- @Override public boolean isReadOnly(int col) throws SQLException {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isWritable(int col) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isDefinitelyWritable(int col) throws SQLException {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public String getColumnClassName(int col) throws SQLException {
- return types.get(col - 1);
- }
-
- /** {@inheritDoc} */
- @Override public <T> T unwrap(Class<T> iface) throws SQLException {
- if (!isWrapperFor(iface))
- throw new SQLException("Result set meta data is not a wrapper for " + iface.getName());
-
- return (T)this;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
- return iface == ResultSetMetaData.class;
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
deleted file mode 100644
index 915c25bf8ae..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * 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.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.sql.SQLWarning;
-import java.sql.Statement;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-import org.apache.ignite.internal.client.GridClientException;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-import static java.sql.ResultSet.CONCUR_READ_ONLY;
-import static java.sql.ResultSet.FETCH_FORWARD;
-import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
-import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
-
-/**
- * JDBC statement implementation.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@Deprecated
-public class JdbcStatement implements Statement {
- /** Task name. */
- private static final String TASK_NAME =
- "org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask";
-
- /** Default fetch size. */
- private static final int DFLT_FETCH_SIZE = 1024;
-
- /** Connection. */
- private final JdbcConnection conn;
-
- /** Closed flag. */
- private boolean closed;
-
- /** Rows limit. */
- private int maxRows;
-
- /** Query timeout. */
- private int timeout;
-
- /** Current result set. */
- private ResultSet rs;
-
- /** Query arguments. */
- protected Object[] args;
-
- /** Fetch size. */
- private int fetchSize = DFLT_FETCH_SIZE;
-
- /**
- * Creates new statement.
- *
- * @param conn Connection.
- */
- JdbcStatement(JdbcConnection conn) {
- assert conn != null;
-
- this.conn = conn;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet executeQuery(String sql) throws SQLException {
- ensureNotClosed();
-
- rs = null;
-
- if (sql == null || sql.isEmpty())
- throw new SQLException("SQL query is empty");
-
- try {
- byte[] packet = conn.client().compute().execute(TASK_NAME,
- JdbcUtils.marshalArgument(JdbcUtils.taskArgument(conn.nodeId(), conn.cacheName(), sql,
- timeout, args, fetchSize, maxRows)));
-
- byte status = packet[0];
- byte[] data = new byte[packet.length - 1];
-
- U.arrayCopy(packet, 1, data, 0, data.length);
-
- if (status == 1)
- throw JdbcUtils.unmarshalError(data);
- else {
- List<?> msg = JdbcUtils.unmarshal(data);
-
- assert msg.size() == 7;
-
- UUID nodeId = (UUID)msg.get(0);
- UUID futId = (UUID)msg.get(1);
- List<String> tbls = (List<String>)msg.get(2);
- List<String> cols = (List<String>)msg.get(3);
- List<String> types = (List<String>)msg.get(4);
- Collection<List<Object>> fields = (Collection<List<Object>>)msg.get(5);
- boolean finished = (Boolean)msg.get(6);
-
- return new JdbcResultSet(this, nodeId, futId, tbls, cols, types, fields, finished, fetchSize);
- }
- }
- catch (GridClientException e) {
- throw new SQLException("Failed to query Ignite.", e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public int executeUpdate(String sql) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void close() throws SQLException {
- closed = true;
- }
-
- /** {@inheritDoc} */
- @Override public int getMaxFieldSize() throws SQLException {
- ensureNotClosed();
-
- return 0;
- }
-
- /** {@inheritDoc} */
- @Override public void setMaxFieldSize(int max) throws SQLException {
- ensureNotClosed();
-
- 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();
-
- this.maxRows = maxRows;
- }
-
- /** {@inheritDoc} */
- @Override public void setEscapeProcessing(boolean enable) throws SQLException {
- ensureNotClosed();
- }
-
- /** {@inheritDoc} */
- @Override public int getQueryTimeout() throws SQLException {
- ensureNotClosed();
-
- return timeout;
- }
-
- /** {@inheritDoc} */
- @Override public void setQueryTimeout(int timeout) throws SQLException {
- ensureNotClosed();
-
- this.timeout = timeout * 1000;
- }
-
- /** {@inheritDoc} */
- @Override public void cancel() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("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();
-
- rs = executeQuery(sql);
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getResultSet() throws SQLException {
- ensureNotClosed();
-
- ResultSet rs0 = rs;
-
- rs = null;
-
- return rs0;
- }
-
- /** {@inheritDoc} */
- @Override public int getUpdateCount() throws SQLException {
- ensureNotClosed();
-
- return -1;
- }
-
- /** {@inheritDoc} */
- @Override public boolean getMoreResults() throws SQLException {
- ensureNotClosed();
-
- return false;
- }
-
- /** {@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 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();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public void clearBatch() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public int[] executeBatch() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public Connection getConnection() throws SQLException {
- ensureNotClosed();
-
- return conn;
- }
-
- /** {@inheritDoc} */
- @Override public boolean getMoreResults(int curr) throws SQLException {
- ensureNotClosed();
-
- if (curr == KEEP_CURRENT_RESULT || curr == CLOSE_ALL_RESULTS)
- throw new SQLFeatureNotSupportedException("Multiple open results are not supported.");
-
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public ResultSet getGeneratedKeys() throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public int executeUpdate(String sql, int[] colIndexes) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public int executeUpdate(String sql, String[] colNames) throws SQLException {
- ensureNotClosed();
-
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
- ensureNotClosed();
-
- if (autoGeneratedKeys == RETURN_GENERATED_KEYS)
- throw new SQLFeatureNotSupportedException("Updates are not supported.");
-
- return execute(sql);
- }
-
- /** {@inheritDoc} */
- @Override public boolean execute(String sql, int[] colIndexes) throws SQLException {
- ensureNotClosed();
-
- if (colIndexes != null && colIndexes.length > 0)
- throw new SQLFeatureNotSupportedException("Updates 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("Updates are not supported.");
-
- return execute(sql);
- }
-
- /** {@inheritDoc} */
- @Override public int getResultSetHoldability() throws SQLException {
- ensureNotClosed();
-
- return HOLD_CURSORS_OVER_COMMIT;
- }
-
- /** {@inheritDoc} */
- @Override public boolean isClosed() throws SQLException {
- return 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 <T> T unwrap(Class<T> iface) throws SQLException {
- if (!isWrapperFor(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 == Statement.class;
- }
-
- /** {@inheritDoc} */
- @Override public void closeOnCompletion() throws SQLException {
- throw new SQLFeatureNotSupportedException("closeOnCompletion is not supported.");
- }
-
- /** {@inheritDoc} */
- @Override public boolean isCloseOnCompletion() throws SQLException {
- ensureNotClosed();
-
- return false;
- }
-
- /**
- * Sets timeout in milliseconds.
- *
- * @param timeout Timeout.
- */
- void timeout(int timeout) {
- this.timeout = timeout;
- }
-
- /**
- * @return Connection.
- */
- JdbcConnection connection() {
- return conn;
- }
-
- /**
- * Ensures that statement is not closed.
- *
- * @throws SQLException If statement is closed.
- */
- protected void ensureNotClosed() throws SQLException {
- if (closed)
- throw new SQLException("Statement is closed.");
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
deleted file mode 100644
index 7fadbcc7cf9..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * 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.math.BigDecimal;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-
-import static java.sql.Types.BIGINT;
-import static java.sql.Types.BINARY;
-import static java.sql.Types.BOOLEAN;
-import static java.sql.Types.DATE;
-import static java.sql.Types.DECIMAL;
-import static java.sql.Types.DOUBLE;
-import static java.sql.Types.FLOAT;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.OTHER;
-import static java.sql.Types.SMALLINT;
-import static java.sql.Types.TIME;
-import static java.sql.Types.TIMESTAMP;
-import static java.sql.Types.TINYINT;
-import static java.sql.Types.VARCHAR;
-
-/**
- * Utility methods for JDBC driver.
- *
- * @deprecated Using Ignite client node based JDBC driver is preferable.
- * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
- */
-@Deprecated
-class JdbcUtils {
- /** Marshaller. */
- private static final Marshaller MARSHALLER = new JdkMarshaller();
-
- /**
- * Marshals task argument to byte array.
- *
- * @param args Task argument.
- * @return Byte array.
- * @throws SQLException In marshalling failed.
- */
- public static byte[] marshalArgument(Map<String, Object> args) throws SQLException {
- assert args != null;
-
- try {
- return U.marshal(MARSHALLER, args);
- }
- catch (IgniteCheckedException e) {
- throw new SQLException("Failed to unmarshal result.", e);
- }
- }
-
- /**
- * Unmarshals exception from byte array.
- *
- * @param bytes Byte array.
- * @return Exception.
- * @throws SQLException If unmarshalling failed.
- */
- public static SQLException unmarshalError(byte[] bytes) throws SQLException {
- return unmarshal(bytes);
- }
-
- /**
- * Unmarshals object from byte array.
- *
- * @param bytes Byte array.
- * @return Object.
- * @throws SQLException If unmarshalling failed.
- */
- public static <T> T unmarshal(byte[] bytes) throws SQLException {
- assert bytes != null;
-
- try {
- return U.unmarshal(MARSHALLER, bytes, null);
- }
- catch (IgniteCheckedException e) {
- throw new SQLException("Failed to unmarshal result.", e);
- }
- }
-
- /**
- * Creates task argument for first execution.
- *
- * @param nodeId Node ID.
- * @param cacheName Cache name.
- * @param sql SQL query.
- * @param timeout Query timeout.
- * @param args Query arguments.
- * @param pageSize Page size.
- * @param maxRows Maximum number of rows.
- * @return Task argument.
- */
- public static Map<String, Object> taskArgument(UUID nodeId, String cacheName, String sql,
- long timeout, Object[] args, int pageSize, int maxRows) {
- assert sql != null;
- assert timeout >= 0;
- assert pageSize > 0;
- assert maxRows >= 0;
-
- Map<String, Object> map = U.newHashMap(7);
-
- map.put("confNodeId", nodeId);
- map.put("cache", cacheName);
- map.put("sql", sql);
- map.put("timeout", timeout);
- map.put("args", args != null ? Arrays.asList(args) : Collections.emptyList());
- map.put("pageSize", pageSize);
- map.put("maxRows", maxRows);
-
- return map;
- }
-
- /**
- * Creates task argument.
- *
- * @param nodeId Node ID.
- * @param futId Future ID.
- * @param pageSize Page size.
- * @param maxRows Maximum number of rows.
- * @return Task argument.
- */
- public static Map<String, Object> taskArgument(UUID nodeId, UUID futId, int pageSize, int maxRows) {
- assert nodeId != null;
- assert futId != null;
- assert pageSize > 0;
- assert maxRows >= 0;
-
- Map<String, Object> map = U.newHashMap(4);
-
- map.put("nodeId", nodeId);
- map.put("futId", futId);
- map.put("pageSize", pageSize);
- map.put("maxRows", maxRows);
-
- return map;
- }
-
- /**
- * Converts Java class name to type from {@link Types}.
- *
- * @param cls Java class name.
- * @return Type from {@link Types}.
- */
- public static int type(String cls) {
- if (Boolean.class.getName().equals(cls) || boolean.class.getName().equals(cls))
- return BOOLEAN;
- else if (Byte.class.getName().equals(cls) || byte.class.getName().equals(cls))
- return TINYINT;
- else if (Short.class.getName().equals(cls) || short.class.getName().equals(cls))
- return SMALLINT;
- else if (Integer.class.getName().equals(cls) || int.class.getName().equals(cls))
- return INTEGER;
- else if (Long.class.getName().equals(cls) || long.class.getName().equals(cls))
- return BIGINT;
- else if (Float.class.getName().equals(cls) || float.class.getName().equals(cls))
- return FLOAT;
- else if (Double.class.getName().equals(cls) || double.class.getName().equals(cls))
- return DOUBLE;
- else if (String.class.getName().equals(cls))
- return VARCHAR;
- else if (byte[].class.getName().equals(cls))
- return BINARY;
- else if (Time.class.getName().equals(cls))
- return TIME;
- else if (Timestamp.class.getName().equals(cls))
- return TIMESTAMP;
- else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
- return DATE;
- else if (BigDecimal.class.getName().equals(cls))
- return DECIMAL;
- else
- return OTHER;
- }
-
- /**
- * Converts Java class name to SQL type name.
- *
- * @param cls Java class name.
- * @return SQL type name.
- */
- public static String typeName(String cls) {
- if (Boolean.class.getName().equals(cls) || boolean.class.getName().equals(cls))
- return "BOOLEAN";
- else if (Byte.class.getName().equals(cls) || byte.class.getName().equals(cls))
- return "TINYINT";
- else if (Short.class.getName().equals(cls) || short.class.getName().equals(cls))
- return "SMALLINT";
- else if (Integer.class.getName().equals(cls) || int.class.getName().equals(cls))
- return "INTEGER";
- else if (Long.class.getName().equals(cls) || long.class.getName().equals(cls))
- return "BIGINT";
- else if (Float.class.getName().equals(cls) || float.class.getName().equals(cls))
- return "FLOAT";
- else if (Double.class.getName().equals(cls) || double.class.getName().equals(cls))
- return "DOUBLE";
- else if (String.class.getName().equals(cls))
- return "VARCHAR";
- else if (byte[].class.getName().equals(cls))
- return "BINARY";
- else if (Time.class.getName().equals(cls))
- return "TIME";
- else if (Timestamp.class.getName().equals(cls))
- return "TIMESTAMP";
- else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
- return "DATE";
- else if (BigDecimal.class.getName().equals(cls))
- return "DECIMAL";
- else
- return "OTHER";
- }
-
- /**
- * Determines whether type is nullable.
- *
- * @param name Column name.
- * @param cls Java class name.
- * @return {@code True} if nullable.
- */
- public static boolean nullable(String name, String cls) {
- return !"_KEY".equalsIgnoreCase(name) &&
- !"_VAL".equalsIgnoreCase(name) &&
- !(boolean.class.getName().equals(cls) ||
- byte.class.getName().equals(cls) ||
- short.class.getName().equals(cls) ||
- int.class.getName().equals(cls) ||
- long.class.getName().equals(cls) ||
- float.class.getName().equals(cls) ||
- double.class.getName().equals(cls));
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java
deleted file mode 100644
index fdbcf4824e3..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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.processors.cache.query.jdbc;
-
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskAdapter;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
-import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.resources.LoggerResource;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task that gets metadata for JDBC adapter.
- */
-public class GridCacheQueryJdbcMetadataTask extends ComputeTaskAdapter<String, byte[]> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Marshaller. */
- private static final Marshaller MARSHALLER = new JdkMarshaller();
-
- /** */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** {@inheritDoc} */
- @NotNull @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
- @Nullable String cacheName) {
- Map<JdbcDriverMetadataJob, ClusterNode> map = new HashMap<>();
-
- IgniteKernal kernal = (IgniteKernal)ignite;
-
- GridDiscoveryManager discoMgr = kernal.context().discovery();
-
- for (ClusterNode n : subgrid)
- if (discoMgr.cacheAffinityNode(n, cacheName)) {
- map.put(new JdbcDriverMetadataJob(cacheName), n);
-
- break;
- }
-
- return map;
- }
-
- /** {@inheritDoc} */
- @Override public byte[] reduce(List<ComputeJobResult> results) {
- return F.first(results).getData();
- }
-
- /**
- * Job for JDBC adapter.
- */
- private static class JdbcDriverMetadataJob extends ComputeJobAdapter {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Cache name. */
- private final String cacheName;
-
- /** Grid instance. */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** Logger. */
- @LoggerResource
- private IgniteLogger log;
-
- /**
- * @param cacheName Cache name.
- */
- private JdbcDriverMetadataJob(@Nullable String cacheName) {
- this.cacheName = cacheName;
- }
-
- /** {@inheritDoc} */
- @Override public Object execute() {
- byte status;
- byte[] data;
-
- try {
- IgniteInternalCache<?, ?> cache = ((IgniteEx)ignite).cachex(cacheName);
-
- assert cache != null;
-
- Collection<GridCacheSqlMetadata> metas = cache.context().queries().sqlMetadata();
-
- Map<String, Map<String, Map<String, String>>> schemasMap = U.newHashMap(metas.size());
-
- Collection<List<Object>> indexesInfo = new LinkedList<>();
-
- for (GridCacheSqlMetadata meta : metas) {
- String name = meta.cacheName();
-
- if (name == null)
- name = "PUBLIC";
-
- Collection<String> types = meta.types();
-
- Map<String, Map<String, String>> typesMap = U.newHashMap(types.size());
-
- for (String type : types) {
- typesMap.put(type.toUpperCase(), meta.fields(type));
-
- for (GridCacheSqlIndexMetadata idx : meta.indexes(type)) {
- int cnt = 0;
-
- for (String field : idx.fields()) {
- indexesInfo.add(F.<Object>asList(name, type.toUpperCase(), !idx.unique(),
- idx.name().toUpperCase(), ++cnt, field, idx.descending(field)));
- }
- }
- }
-
- schemasMap.put(name, typesMap);
- }
-
- status = 0;
-
- data = U.marshal(MARSHALLER, F.asList(schemasMap, indexesInfo));
- }
- catch (Throwable t) {
- U.error(log, "Failed to get metadata for JDBC.", t);
-
- SQLException err = new SQLException(t.getMessage());
-
- status = 1;
-
- try {
- data = U.marshal(MARSHALLER, err);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
-
- if (t instanceof Error)
- throw (Error)t;
- }
-
- byte[] packet = new byte[data.length + 1];
-
- packet[0] = status;
-
- U.arrayCopy(data, 0, packet, 1, data.length);
-
- return packet;
- }
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
deleted file mode 100644
index e2d04de476a..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * 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.processors.cache.query.jdbc;
-
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeJobResultPolicy;
-import org.apache.ignite.compute.ComputeTaskAdapter;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
-import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
-import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
-import org.apache.ignite.internal.util.typedef.CAX;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.resources.LoggerResource;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.compute.ComputeJobResultPolicy.WAIT;
-
-/**
- * Task for JDBC adapter.
- */
-public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Marshaller. */
- private static final Marshaller MARSHALLER = new JdkMarshaller();
-
- /** How long to store future (10 minutes). */
- private static final int RMV_DELAY = 10 * 60 * 1000;
-
- /** Scheduler. */
- private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1);
-
- /** Ignite. */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** {@inheritDoc} */
- @NotNull @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, byte[] arg) {
- try {
- assert arg != null;
-
- Map<String, Object> args = U.unmarshal(MARSHALLER, arg, null);
-
- boolean first = true;
-
- UUID nodeId = (UUID)args.remove("confNodeId");
-
- if (nodeId == null) {
- nodeId = (UUID)args.remove("nodeId");
-
- first = nodeId == null;
- }
-
- if (nodeId != null) {
- for (ClusterNode n : subgrid)
- if (n.id().equals(nodeId))
- return F.asMap(new JdbcDriverJob(args, first), n);
-
- throw new IgniteException("Node doesn't exist or left the grid: " + nodeId);
- }
- else {
- String cache = (String)args.get("cache");
-
- Map<? extends ComputeJob, ClusterNode> node = null;
-
- if (cache == null) {
- boolean start = ignite.configuration().isClientMode();
-
- IgniteCache<?, ?> cache0 =
- ((IgniteKernal)ignite).context().cache().getOrStartPublicCache(start);
-
- if (cache0 != null)
- node = mapToNode(subgrid, args, first, cache0.getName());
- }
- else
- node = mapToNode(subgrid, args, first, cache);
-
- if (node != null)
- return node;
- else
- throw new IgniteException("Can't find node with cache: " + cache);
- }
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
- }
- }
-
- /**
- * @param subgrid Subgrid.
- * @param args Args.
- * @param first First.
- * @param cache Cache.
- */
- @Nullable private Map<? extends ComputeJob, ClusterNode> mapToNode(
- List<ClusterNode> subgrid,
- Map<String, Object> args,
- boolean first,
- String cache
- ) {
- GridDiscoveryManager discoMgr = ((IgniteKernal)ignite).context().discovery();
-
- for (ClusterNode n : subgrid) {
- if (discoMgr.cacheAffinityNode(n, cache)) {
- args.put("cache", cache);
-
- return F.asMap(new JdbcDriverJob(args, first), n);
- }
- }
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public byte[] reduce(List<ComputeJobResult> results) throws IgniteException {
- try {
- byte status;
- byte[] bytes;
-
- ComputeJobResult res = F.first(results);
-
- if (res.getException() == null) {
- status = 0;
-
- bytes = U.marshal(MARSHALLER, res.getData());
- }
- else {
- status = 1;
-
- bytes = U.marshal(MARSHALLER, new SQLException(res.getException().getMessage()));
- }
-
- byte[] packet = new byte[bytes.length + 1];
-
- packet[0] = status;
-
- U.arrayCopy(bytes, 0, packet, 1, bytes.length);
-
- return packet;
- }
- catch (IgniteCheckedException e) {
- throw U.convertException(e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
- return WAIT;
- }
-
- /**
- * Job for JDBC adapter.
- */
- private static class JdbcDriverJob extends ComputeJobAdapter {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Arguments. */
- private final Map<String, Object> args;
-
- /** First execution flag. */
- private final boolean first;
-
- /** Grid instance. */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /** Logger. */
- @LoggerResource
- private IgniteLogger log;
-
- /**
- * @param args Arguments.
- * @param first First execution flag.
- */
- JdbcDriverJob(Map<String, Object> args, boolean first) {
- assert args != null;
- assert args.size() == (first ? 6 : 3);
-
- this.args = args;
- this.first = first;
- }
-
- /** {@inheritDoc} */
- @Override public Object execute() {
- String cacheName = argument("cache");
- String sql = argument("sql");
- Long timeout = argument("timeout");
- List<Object> args = argument("args");
- UUID futId = argument("futId");
- final int pageSize = argument("pageSize");
- final int maxRows = argument("maxRows");
-
- assert maxRows >= 0 : maxRows;
-
- Cursor c = null;
-
- Collection<String> tbls = null;
- Collection<String> cols = null;
- Collection<String> types = null;
-
- if (first) {
- assert sql != null;
- assert timeout != null;
- assert args != null;
- assert futId == null;
-
- IgniteCache<?, ?> cache = ignite.cache(cacheName);
-
- if (cache == null && cacheName == null) {
- try {
- boolean start = ignite.configuration().isClientMode();
-
- cache = ((IgniteKernal)ignite).context().cache().getOrStartPublicCache(start);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
-
- if (cache == null)
- throw new IgniteException(new SQLException("Cache not found [cacheName=" + cacheName + ']'));
-
- SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(args.toArray());
-
- qry.setPageSize(pageSize);
-
- QueryCursor<List<?>> cursor = cache.withKeepBinary().query(qry);
-
- Collection<GridQueryFieldMetadata> meta = ((QueryCursorImpl<List<?>>)cursor).fieldsMeta();
-
- assert meta != null;
-
- tbls = new ArrayList<>(meta.size());
- cols = new ArrayList<>(meta.size());
- types = new ArrayList<>(meta.size());
-
- for (GridQueryFieldMetadata desc : meta) {
- tbls.add(desc.typeName());
- cols.add(desc.fieldName().toUpperCase());
- types.add(desc.fieldTypeName());
- }
-
- futId = UUID.randomUUID();
-
- c = new Cursor(cursor, cursor.iterator(), 0, U.currentTimeMillis());
- }
-
- assert futId != null;
-
- ConcurrentMap<UUID, Cursor> m = ignite.cluster().nodeLocalMap();
-
- if (c == null)
- c = m.get(futId);
-
- if (c == null)
- throw new IgniteException("Cursor was removed due to long inactivity.");
-
- Collection<List<?>> rows = new ArrayList<>();
-
- int totalCnt = c.totalCnt;
-
- boolean finished = true;
-
- for (List<?> row : c) {
- List<Object> row0 = new ArrayList<>(row.size());
-
- for (Object val : row)
- row0.add(sqlType(val) ? val : val.toString());
-
- rows.add(row0);
-
- if (++totalCnt == maxRows) // If maxRows is 0 then unlimited
- break;
-
- if (rows.size() == pageSize) {
- finished = false;
-
- break;
- }
- }
-
- if (!finished) {
- if (first) {
- m.put(futId, c);
-
- scheduleRemoval(futId, RMV_DELAY);
- }
- else if (!m.replace(futId, c, new Cursor(c.cursor, c.iter, totalCnt, U.currentTimeMillis())))
- assert !m.containsKey(futId) : "Concurrent cursor modification.";
- }
- else if (first) // No need to remove.
- c.cursor.close();
- else
- remove(futId, c);
-
- return first ? F.asList(ignite.cluster().localNode().id(), futId, tbls, cols, types, rows, finished) :
- F.asList(rows, finished);
- }
-
- /**
- * @param futId Cursor ID.
- * @param c Cursor.
- * @return {@code true} If succeeded.
- */
- private boolean remove(UUID futId, Cursor c) {
- if (ignite.cluster().<UUID, Cursor>nodeLocalMap().remove(futId, c)) {
- c.cursor.close();
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Schedules removal of stored future.
- *
- * @param id Future ID.
- * @param delay Delay in milliseconds.
- */
- private void scheduleRemoval(final UUID id, long delay) {
- SCHEDULER.schedule(new CAX() {
- @Override public void applyx() {
- for (;;) {
- Cursor c = ignite.cluster().<UUID, Cursor>nodeLocalMap().get(id);
-
- if (c == null)
- break;
-
- // If the cursor was accessed since last scheduling then reschedule.
- long untouchedTime = U.currentTimeMillis() - c.lastAccessTime;
-
- if (untouchedTime < RMV_DELAY) {
- scheduleRemoval(id, RMV_DELAY - untouchedTime);
-
- break;
- }
- else if (remove(id, c))
- break;
- }
- }
- }, delay, TimeUnit.MILLISECONDS);
- }
-
- /**
- * Checks whether type of the object is SQL-complaint.
- *
- * @param obj Object.
- * @return Whether type of the object is SQL-complaint.
- */
- private static boolean sqlType(Object obj) {
- return obj == null ||
- obj instanceof BigDecimal ||
- obj instanceof Boolean ||
- obj instanceof Byte ||
- obj instanceof byte[] ||
- obj instanceof Date ||
- obj instanceof Double ||
- obj instanceof Float ||
- obj instanceof Integer ||
- obj instanceof Long ||
- obj instanceof Short ||
- obj instanceof String ||
- obj instanceof URL;
- }
-
- /**
- * Gets argument.
- *
- * @param key Key.
- * @return Argument.
- */
- private <T> T argument(String key) {
- return (T)args.get(key);
- }
- }
-
- /**
- * Cursor.
- */
- private static final class Cursor implements Iterable<List<?>> {
- /** */
- final QueryCursor<List<?>> cursor;
-
- /** */
- final Iterator<List<?>> iter;
-
- /** */
- final int totalCnt;
-
- /** */
- final long lastAccessTime;
-
- /**
- * @param cursor Cursor.
- * @param iter Iterator.
- * @param totalCnt Total row count already fetched.
- * @param lastAccessTime Last cursor access timestamp.
- */
- private Cursor(QueryCursor<List<?>> cursor, Iterator<List<?>> iter, int totalCnt, long lastAccessTime) {
- this.cursor = cursor;
- this.iter = iter;
- this.totalCnt = totalCnt;
- this.lastAccessTime = lastAccessTime;
- }
-
- /** {@inheritDoc} */
- @Override public Iterator<List<?>> iterator() {
- return iter;
- }
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcValidationTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcValidationTask.java
deleted file mode 100644
index 5d7fadb7d73..00000000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcValidationTask.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.processors.cache.query.jdbc;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task to validate connection. Checks that cache with provided name exists in grid.
- */
-public class GridCacheQueryJdbcValidationTask extends ComputeTaskSplitAdapter<String, Boolean> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** {@inheritDoc} */
- @Override protected Collection<? extends ComputeJob> split(int gridSize, @Nullable final String cacheName) {
- return Collections.singleton(new ComputeJobAdapter() {
- @IgniteInstanceResource
- private Ignite ignite;
-
- @Override public Object execute() {
- if (cacheName == null)
- return true;
-
- GridDiscoveryManager discoMgr = ((IgniteKernal)ignite).context().discovery();
-
- for (ClusterNode n : ignite.cluster().nodes())
- if (discoMgr.cacheNode(n, cacheName))
- return true;
-
- return false;
- }
- });
- }
-
- /** {@inheritDoc} */
- @Override public Boolean reduce(List<ComputeJobResult> results) {
- return F.first(results).getData();
- }
-}
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index be011d4bf45..19842ee40c9 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
org.apache.ignite.IgniteAuthenticationException
org.apache.ignite.IgniteCacheRestartingException
org.apache.ignite.IgniteCheckedException
@@ -403,8 +404,6 @@ org.apache.ignite.internal.events.DiscoveryCustomEvent
org.apache.ignite.internal.executor.GridExecutorService
org.apache.ignite.internal.executor.GridExecutorService$1
org.apache.ignite.internal.executor.GridExecutorService$TaskTerminateListener
-org.apache.ignite.internal.jdbc.JdbcConnectionValidationTask
-org.apache.ignite.internal.jdbc.JdbcConnectionValidationTask$1
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$1
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$2
@@ -426,7 +425,6 @@ org.apache.ignite.internal.jdbc2.JdbcQueryTask$1
org.apache.ignite.internal.jdbc2.JdbcQueryTaskResult
org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2
org.apache.ignite.internal.jdbc2.JdbcQueryTaskV3
-org.apache.ignite.internal.managers.GridManagerAdapter$1$1
org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointSet
org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest
org.apache.ignite.internal.managers.communication.GridIoManager$ConcurrentHashMap0
@@ -450,10 +448,9 @@ org.apache.ignite.internal.managers.discovery.DiscoCache$3
org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage
org.apache.ignite.internal.managers.discovery.DiscoveryServerOnlyCustomMessage
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$1
-org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$2
-org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$4$1
+org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$3$1
+org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$6
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$7
-org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$8
org.apache.ignite.internal.managers.discovery.IncompleteDeserializationException
org.apache.ignite.internal.managers.discovery.SecurityAwareCustomMessageWrapper
org.apache.ignite.internal.managers.encryption.CacheGroupEncryptionKeys$TrackedWalSegment
@@ -1156,7 +1153,6 @@ org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandler
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerRestoreTask$SnapshotHandlerRestoreJob
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerResult
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerType
-org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotHandlerWarningException
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadata
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadataCollectorTask
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotMetadataCollectorTask$1
@@ -1170,6 +1166,7 @@ org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotPartiti
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreProcess$SnapshotRestoreOperationResponse
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreStatusTask
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreStatusTask$1
+org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotWarningException
org.apache.ignite.internal.processors.cache.persistence.snapshot.TrackingPageIsCorruptedException
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Bool
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Result
@@ -1262,13 +1259,6 @@ org.apache.ignite.internal.processors.cache.query.continuous.SecurityAwareFilter
org.apache.ignite.internal.processors.cache.query.continuous.SecurityAwareFilterFactory
org.apache.ignite.internal.processors.cache.query.continuous.SecurityAwareTransformerFactory
org.apache.ignite.internal.processors.cache.query.continuous.SecurityAwareTransformerFactory$1
-org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcMetadataTask
-org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcMetadataTask$JdbcDriverMetadataJob
-org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask
-org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask$JdbcDriverJob
-org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcTask$JdbcDriverJob$1
-org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidationTask
-org.apache.ignite.internal.processors.cache.query.jdbc.GridCacheQueryJdbcValidationTask$1
org.apache.ignite.internal.processors.cache.query.reducer.CacheQueryReducer
org.apache.ignite.internal.processors.cache.query.reducer.IndexQueryReducer
org.apache.ignite.internal.processors.cache.query.reducer.IndexQueryReducer$IndexedNodePageComparator
@@ -1794,7 +1784,6 @@ org.apache.ignite.internal.processors.task.GridTaskProcessor$1
org.apache.ignite.internal.processors.task.GridTaskWorker$2
org.apache.ignite.internal.processors.task.GridTaskWorker$4
org.apache.ignite.internal.processors.task.GridTaskWorker$State
-org.apache.ignite.internal.processors.task.TaskExecutionOptions
org.apache.ignite.internal.processors.task.monitor.ComputeTaskStatusEnum
org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor$2
org.apache.ignite.internal.processors.tracing.SpanType
@@ -2141,6 +2130,10 @@ org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTask
org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTask$VisorCacheMetricsJob
org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTaskArg
org.apache.ignite.internal.visor.cache.metrics.VisorCacheMetricsTaskResult
+org.apache.ignite.internal.visor.cdc.VisorCdcDeleteLostSegmentsTask
+org.apache.ignite.internal.visor.cdc.VisorCdcDeleteLostSegmentsTask$VisorCdcDeleteLostSegmentsJob
+org.apache.ignite.internal.visor.client.VisorClientConnectionDropTask
+org.apache.ignite.internal.visor.client.VisorClientConnectionDropTask$VisorClientConnectionDropJob
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionTask
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionTask$VisorComputeCancelSessionJob
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionTaskArg
diff --git a/modules/yardstick/config/benchmark-query.properties b/modules/yardstick/config/benchmark-query.properties
index ee88beb1bd7..0f9f9372e52 100644
--- a/modules/yardstick/config/benchmark-query.properties
+++ b/modules/yardstick/config/benchmark-query.properties
@@ -78,6 +78,5 @@ CONFIGS="\
-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryBenchmark -sn IgniteNode -ds ${ver}sql-query-${b}-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryJoinBenchmark -sn IgniteNode -ds ${ver}sql-query-join-${b}-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteSqlQueryPutBenchmark -sn IgniteNode -ds ${ver}sql-query-put-${b}-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite://127.0.0.1/query -t ${t} -sm ${sm} -dn IgniteJdbcSqlQueryBenchmark -sn IgniteNode -ds ${ver}sql-query-jdbc-${b}-backup,\
-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:cfg://cache=query@config/ignite-jdbc-config.xml -t ${t} -sm ${sm} -dn IgniteJdbcSqlQueryBenchmark -sn IgniteNode -ds ${ver}sql-query-jdbc-${b}-backup\
"