diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 8a17b07..4664f07 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -7,7 +7,7 @@ on:
- develop
- release*
pull_request:
- type: [opened, reopened, edited]
+ type: [opened, reopened, edited, synchronize]
jobs:
build:
@@ -152,3 +152,5 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e55c50..a3dc79e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 2.1.0 ##
+
+* Added support for QueryService
+* Added configs for custom iam enpoint and metadata URL
+* Upgraded to YDB Java SDK 2.2.0
+
## 2.0.7 ##
* Added getter for GrpcTransport to YdbContext
diff --git a/README.md b/README.md
index 0970277..aa1f481 100644
--- a/README.md
+++ b/README.md
@@ -25,14 +25,14 @@ Specify the YDB JDBC driver in the dependencies:
tech.ydb.jdbc
ydb-jdbc-driver
- 2.0.7
+ 2.1.0
tech.ydb.jdbc
ydb-jdbc-driver-shaded
- 2.0.7
+ 2.1.0
```
@@ -50,8 +50,10 @@ YDB JDBC Driver supports the following [authentication modes](https://ydb.tech/e
Driver supports the following configuration properties, which can be specified in the URL or passed via extra properties:
* `saFile` - service account key for authentication, can be passed either as literal JSON value or as a file reference;
+* `iamEndpoint` - custom IAM endpoint for authentication via service account key;
* `token` - token value for authentication, can be passed either as literal value or as a file reference;
* `useMetadata` - boolean value, true if metadata authentication should be used, false otherwise (and default);
+* `metadataURL` - custom metadata endpoint;
* `localDatacenter` - name of the datacenter local to the application being connected;
* `secureConnection` - boolean value, true if TLS should be enforced (normally configured via `grpc://` or `grpcs://` scheme in the JDBC URL);
* `secureConnectionCertificate` - custom CA certificate for TLS connections, can be passed either as literal value or as a file reference.
diff --git a/config/ydb.checkstyle.xml b/config/ydb.checkstyle.xml
new file mode 100644
index 0000000..ab26539
--- /dev/null
+++ b/config/ydb.checkstyle.xml
@@ -0,0 +1,249 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/ydb.suppressions.xml b/config/ydb.suppressions.xml
new file mode 100644
index 0000000..fe45ca6
--- /dev/null
+++ b/config/ydb.suppressions.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/jdbc-shaded/pom.xml b/jdbc-shaded/pom.xml
index 9918411..74af959 100644
--- a/jdbc-shaded/pom.xml
+++ b/jdbc-shaded/pom.xml
@@ -6,7 +6,7 @@
tech.ydb.jdbc
ydb-jdbc-driver-parent
- 2.0.7
+ 2.1.0
ydb-jdbc-driver-shaded
diff --git a/jdbc/pom.xml b/jdbc/pom.xml
index 1b0c9ae..49d3988 100644
--- a/jdbc/pom.xml
+++ b/jdbc/pom.xml
@@ -6,7 +6,7 @@
tech.ydb.jdbc
ydb-jdbc-driver-parent
- 2.0.7
+ 2.1.0
ydb-jdbc-driver
@@ -14,6 +14,10 @@
JDBC Driver over YDB Java SDK
+
+ tech.ydb
+ ydb-sdk-query
+
tech.ydb
ydb-sdk-table
@@ -53,6 +57,10 @@
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
org.apache.maven.plugins
maven-source-plugin
diff --git a/jdbc/src/main/java/tech/ydb/jdbc/YdbConnection.java b/jdbc/src/main/java/tech/ydb/jdbc/YdbConnection.java
index 4e6b901..b65dab4 100644
--- a/jdbc/src/main/java/tech/ydb/jdbc/YdbConnection.java
+++ b/jdbc/src/main/java/tech/ydb/jdbc/YdbConnection.java
@@ -2,17 +2,16 @@
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.List;
import javax.annotation.Nullable;
-import tech.ydb.jdbc.query.YdbQuery;
import tech.ydb.jdbc.context.YdbContext;
-import tech.ydb.jdbc.context.YdbExecutor;
-import tech.ydb.table.query.DataQueryResult;
+import tech.ydb.jdbc.context.YdbValidator;
+import tech.ydb.jdbc.query.YdbQuery;
import tech.ydb.table.query.ExplainDataQueryResult;
import tech.ydb.table.query.Params;
import tech.ydb.table.result.ResultSetReader;
-import tech.ydb.table.settings.ExecuteDataQuerySettings;
public interface YdbConnection extends Connection {
@@ -38,44 +37,46 @@ public interface YdbConnection extends Connection {
* Explicitly execute query as a schema query
*
* @param query query (DDL) to execute
- * @param executor executor for logging and warnings
+ * @param validator handler for logging and warnings
* @throws SQLException if query cannot be executed
*/
- void executeSchemeQuery(YdbQuery query, YdbExecutor executor) throws SQLException;
+ void executeSchemeQuery(YdbQuery query, YdbValidator validator) throws SQLException;
/**
* Explicitly execute query as a data query
*
* @param query query to execute
* @param params parameters for query
- * @param settings settings of execution
- * @param executor executor for logging and warnings
+ * @param timeout timeout of operation
+ * @param keepInCache flag to store query in server-side cache
+ * @param validator handler for logging and warnings
* @return list of result set
* @throws SQLException if query cannot be executed
*/
- DataQueryResult executeDataQuery(YdbQuery query, YdbExecutor executor, ExecuteDataQuerySettings settings, Params params) throws SQLException;
+ List executeDataQuery(YdbQuery query, YdbValidator validator,
+ int timeout, boolean keepInCache, Params params) throws SQLException;
/**
* Explicitly execute query as a scan query
*
* @param query query to execute
* @param params parameters for query
- * @param executor executor for logging and warnings
+ * @param validator handler for logging and warnings
* @return single result set with rows
* @throws SQLException if query cannot be executed
*/
- ResultSetReader executeScanQuery(YdbQuery query, YdbExecutor executor, Params params) throws SQLException;
+ ResultSetReader executeScanQuery(YdbQuery query, YdbValidator validator, Params params) throws SQLException;
/**
* Explicitly explain this query
*
* @param query query to explain
- * @param executor executor for logging and warnings
+ * @param validator handler for logging and warnings
* @return list of result set of two string columns: {@link YdbConst#EXPLAIN_COLUMN_AST}
* and {@link YdbConst#EXPLAIN_COLUMN_PLAN}
* @throws SQLException if query cannot be explained
*/
- ExplainDataQueryResult executeExplainQuery(YdbQuery query, YdbExecutor executor) throws SQLException;
+ ExplainDataQueryResult executeExplainQuery(YdbQuery query, YdbValidator validator) throws SQLException;
@Override
YdbDatabaseMetaData getMetaData() throws SQLException;
diff --git a/jdbc/src/main/java/tech/ydb/jdbc/YdbDriver.java b/jdbc/src/main/java/tech/ydb/jdbc/YdbDriver.java
index 27c14ff..8058b01 100644
--- a/jdbc/src/main/java/tech/ydb/jdbc/YdbDriver.java
+++ b/jdbc/src/main/java/tech/ydb/jdbc/YdbDriver.java
@@ -12,14 +12,12 @@
import javax.annotation.Nullable;
-import tech.ydb.jdbc.context.YdbConfig;
-import tech.ydb.jdbc.impl.YdbConnectionImpl;
import tech.ydb.jdbc.context.YdbContext;
-import tech.ydb.jdbc.settings.YdbJdbcTools;
+import tech.ydb.jdbc.impl.YdbConnectionImpl;
+import tech.ydb.jdbc.settings.YdbConfig;
import tech.ydb.scheme.SchemeClient;
import tech.ydb.table.TableClient;
-import static tech.ydb.jdbc.YdbConst.JDBC_YDB_PREFIX;
/**
* YDB JDBC driver, basic implementation supporting {@link TableClient} and {@link SchemeClient}
@@ -48,13 +46,13 @@ public YdbConnection connect(String url, Properties info) throws SQLException {
return null;
}
- YdbConfig config = new YdbConfig(url, info);
+ YdbConfig config = YdbConfig.from(url, info);
LOGGER.log(Level.FINE, "About to connect to [{0}] using properties {1}", new Object[] {
config.getSafeUrl(),
config.getSafeProps()
});
- if (config.getOperationProperties().isCacheConnectionsInDriver()) {
+ if (config.isCacheConnectionsInDriver()) {
return new YdbConnectionImpl(getCachedContext(config));
}
@@ -74,7 +72,7 @@ public YdbContext getCachedContext(YdbConfig config) throws SQLException {
// Was fixed in Java 9+
YdbContext context = cache.get(config);
if (context != null) {
- LOGGER.log(Level.FINE, "Reusing YDB connection to {0}", config.getConnectionProperties());
+ LOGGER.log(Level.FINE, "Reusing YDB connection to {0}", config.getSafeUrl());
return context;
}
@@ -88,13 +86,13 @@ public YdbContext getCachedContext(YdbConfig config) throws SQLException {
@Override
public boolean acceptsURL(String url) {
- return YdbJdbcTools.isYdb(url);
+ return YdbConfig.isYdb(url);
}
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
- String targetUrl = acceptsURL(url) ? url : JDBC_YDB_PREFIX;
- return YdbJdbcTools.from(targetUrl, info).toDriverProperties();
+ YdbConfig config = YdbConfig.from(url, info);
+ return config.toPropertyInfo();
}
@Override
diff --git a/jdbc/src/main/java/tech/ydb/jdbc/YdbDriverInfo.java b/jdbc/src/main/java/tech/ydb/jdbc/YdbDriverInfo.java
index 62901e5..744f90b 100644
--- a/jdbc/src/main/java/tech/ydb/jdbc/YdbDriverInfo.java
+++ b/jdbc/src/main/java/tech/ydb/jdbc/YdbDriverInfo.java
@@ -11,4 +11,6 @@ public final class YdbDriverInfo {
public static final String DRIVER_FULL_NAME = DRIVER_NAME + " " + DRIVER_VERSION;
public static final int JDBC_MAJOR_VERSION = 4;
public static final int JDBC_MINOR_VERSION = 2;
+
+ private YdbDriverInfo() { }
}
diff --git a/jdbc/src/main/java/tech/ydb/jdbc/common/FixedResultSetFactory.java b/jdbc/src/main/java/tech/ydb/jdbc/common/FixedResultSetFactory.java
index 4bccb52..ab228eb 100644
--- a/jdbc/src/main/java/tech/ydb/jdbc/common/FixedResultSetFactory.java
+++ b/jdbc/src/main/java/tech/ydb/jdbc/common/FixedResultSetFactory.java
@@ -127,7 +127,7 @@ private class FixedResultSet implements ResultSetReader {
private final List