Skip to content

Commit 10c7548

Browse files
authored
Merge pull request #539 from cloudsufi/fem/sqlserver
[PLUGIN-1847] Add SqlServerErrorDetailsProvider
2 parents 9674966 + 53cfd3a commit 10c7548

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

database-commons/src/main/java/io/cdap/plugin/util/DBUtils.java

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public final class DBUtils {
6161

6262
public static final Calendar PURE_GREGORIAN_CALENDAR = createPureGregorianCalender();
6363
public static final String MYSQL_SUPPORTED_DOC_URL = "https://dev.mysql.com/doc/mysql-errors/9.0/en/";
64+
public static final String MSSQL_SUPPORTED_DOC_URL =
65+
"https://docs.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors";
6466
public static final String CLOUDSQLMYSQL_SUPPORTED_DOC_URL = "https://cloud.google.com/sql/docs/mysql/error-messages";
6567
public static final String POSTGRES_SUPPORTED_DOC_URL =
6668
"https://www.postgresql.org/docs/current/errcodes-appendix.html";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright © 2025 Cask Data, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package io.cdap.plugin.mssql;
18+
19+
import io.cdap.plugin.common.db.DBErrorDetailsProvider;
20+
import io.cdap.plugin.util.DBUtils;
21+
22+
/**
23+
* A custom ErrorDetailsProvider for SQL Server plugins.
24+
*/
25+
public class SqlServerErrorDetailsProvider extends DBErrorDetailsProvider {
26+
27+
@Override
28+
protected String getExternalDocumentationLink() {
29+
return DBUtils.MSSQL_SUPPORTED_DOC_URL;
30+
}
31+
}

mssql-plugin/src/main/java/io/cdap/plugin/mssql/SqlServerSink.java

+10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ protected LineageRecorder getLineageRecorder(BatchSinkContext context) {
8888
return new LineageRecorder(context, asset);
8989
}
9090

91+
@Override
92+
protected String getErrorDetailsProviderClassName() {
93+
return SqlServerErrorDetailsProvider.class.getName();
94+
}
95+
96+
@Override
97+
protected String getExternalDocumentationLink() {
98+
return DBUtils.MSSQL_SUPPORTED_DOC_URL;
99+
}
100+
91101
/**
92102
* MSSQL action configuration.
93103
*/

mssql-plugin/src/main/java/io/cdap/plugin/mssql/SqlServerSource.java

+10
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ protected Class<? extends DBWritable> getDBRecordType() {
7575
return SqlServerSourceDBRecord.class;
7676
}
7777

78+
@Override
79+
protected String getErrorDetailsProviderClassName() {
80+
return SqlServerErrorDetailsProvider.class.getName();
81+
}
82+
7883
@Override
7984
protected LineageRecorder getLineageRecorder(BatchSourceContext context) {
8085
String fqn = DBUtils.constructFQN("mssql",
@@ -85,6 +90,11 @@ protected LineageRecorder getLineageRecorder(BatchSourceContext context) {
8590
return new LineageRecorder(context, asset);
8691
}
8792

93+
@Override
94+
protected String getExternalDocumentationLink() {
95+
return DBUtils.MSSQL_SUPPORTED_DOC_URL;
96+
}
97+
8898
/**
8999
* MSSQL source config.
90100
*/

0 commit comments

Comments
 (0)