Skip to content

Commit 19ef1c9

Browse files
Bruce Irschickbirschick-bq
andauthored
[AD-387] Tableau: incorrect error message when connecting with wrong credentials. (#148)
### Summary [AD-387] Tableau: incorrect error message when connecting with wrong credentials. ### Description Updated error text to include username, password and database. ### Related Issue https:/bitquill.atlassian.net/browse/AD-387 * [AD-387] Tableau: incorrect error message when connecting with wrong credentials. https:/bitquill.atlassian.net/browse/AD-387 * [AD-387] Correct test failures. https:/bitquill.atlassian.net/browse/AD-387 * Commit Code Coverage Badge * [AD-387] Improve error message. https:/bitquill.atlassian.net/browse/AD-387 * Commit Code Coverage Badge Co-authored-by: birschick-bq <birschick-bq@users.noreply.github.com>
1 parent 443eaf4 commit 19ef1c9

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

calcite-adapter/src/test/java/software/amazon/documentdb/jdbc/query/DocumentDbQueryMappingServiceMaxRowsTest.java

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@ void testOrderByWithMaxRows() throws SQLException {
130130
Assertions.assertNotNull(result);
131131
Assertions.assertEquals(5, result.getColumnMetaData().size());
132132
Assertions.assertEquals(5, result.getAggregateOperations().size());
133-
Assertions.assertEquals(
134-
BsonDocument.parse(
135-
"{\"$match\": {\"$or\": ["
136-
+ "{\"array.field\": {\"$exists\": true}}, "
137-
+ "{\"array.field1\": {\"$exists\": true}}, "
138-
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
139-
result.getAggregateOperations().get(0));
140133
Assertions.assertEquals(
141134
BsonDocument.parse(
142135
"{ \"$unwind\": {"
143136
+ "\"path\": \"$array\", "
144137
+ "\"includeArrayIndex\" : \"array_index_lvl_0\", "
145138
+ "\"preserveNullAndEmptyArrays\": true }}"),
139+
result.getAggregateOperations().get(0));
140+
Assertions.assertEquals(
141+
BsonDocument.parse(
142+
"{\"$match\": {\"$or\": ["
143+
+ "{\"array.field\": {\"$exists\": true}}, "
144+
+ "{\"array.field1\": {\"$exists\": true}}, "
145+
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
146146
result.getAggregateOperations().get(1));
147147
Assertions.assertEquals(
148148
BsonDocument.parse(
@@ -172,19 +172,19 @@ void testOrderByWithMaxRowsAndLimit() throws SQLException {
172172
Assertions.assertNotNull(result);
173173
Assertions.assertEquals(5, result.getColumnMetaData().size());
174174
Assertions.assertEquals(6, result.getAggregateOperations().size());
175-
Assertions.assertEquals(
176-
BsonDocument.parse(
177-
"{\"$match\": {\"$or\": ["
178-
+ "{\"array.field\": {\"$exists\": true}}, "
179-
+ "{\"array.field1\": {\"$exists\": true}}, "
180-
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
181-
result.getAggregateOperations().get(0));
182175
Assertions.assertEquals(
183176
BsonDocument.parse(
184177
"{ \"$unwind\": {"
185178
+ "\"path\": \"$array\", "
186179
+ "\"includeArrayIndex\" : \"array_index_lvl_0\", "
187180
+ "\"preserveNullAndEmptyArrays\": true }}"),
181+
result.getAggregateOperations().get(0));
182+
Assertions.assertEquals(
183+
BsonDocument.parse(
184+
"{\"$match\": {\"$or\": ["
185+
+ "{\"array.field\": {\"$exists\": true}}, "
186+
+ "{\"array.field1\": {\"$exists\": true}}, "
187+
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
188188
result.getAggregateOperations().get(1));
189189
Assertions.assertEquals(
190190
BsonDocument.parse(
@@ -216,19 +216,19 @@ void testOrderByWithMaxRowsAndInnerLimit() throws SQLException {
216216
Assertions.assertNotNull(result);
217217
Assertions.assertEquals(5, result.getColumnMetaData().size());
218218
Assertions.assertEquals(7, result.getAggregateOperations().size());
219-
Assertions.assertEquals(
220-
BsonDocument.parse(
221-
"{\"$match\": {\"$or\": ["
222-
+ "{\"array.field\": {\"$exists\": true}}, "
223-
+ "{\"array.field1\": {\"$exists\": true}}, "
224-
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
225-
result.getAggregateOperations().get(0));
226219
Assertions.assertEquals(
227220
BsonDocument.parse(
228221
"{ \"$unwind\": {"
229222
+ "\"path\": \"$array\", "
230223
+ "\"includeArrayIndex\" : \"array_index_lvl_0\", "
231224
+ "\"preserveNullAndEmptyArrays\": true }}"),
225+
result.getAggregateOperations().get(0));
226+
Assertions.assertEquals(
227+
BsonDocument.parse(
228+
"{\"$match\": {\"$or\": ["
229+
+ "{\"array.field\": {\"$exists\": true}}, "
230+
+ "{\"array.field1\": {\"$exists\": true}}, "
231+
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
232232
result.getAggregateOperations().get(1));
233233
Assertions.assertEquals(
234234
BsonDocument.parse(
@@ -270,19 +270,19 @@ void testOrderByWithMaxRowsAndInnerLimitAndOuterLimit() throws SQLException {
270270
Assertions.assertNotNull(result);
271271
Assertions.assertEquals(5, result.getColumnMetaData().size());
272272
Assertions.assertEquals(8, result.getAggregateOperations().size());
273-
Assertions.assertEquals(
274-
BsonDocument.parse(
275-
"{\"$match\": {\"$or\": ["
276-
+ "{\"array.field\": {\"$exists\": true}}, "
277-
+ "{\"array.field1\": {\"$exists\": true}}, "
278-
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
279-
result.getAggregateOperations().get(0));
280273
Assertions.assertEquals(
281274
BsonDocument.parse(
282275
"{ \"$unwind\": {"
283276
+ "\"path\": \"$array\", "
284277
+ "\"includeArrayIndex\" : \"array_index_lvl_0\", "
285278
+ "\"preserveNullAndEmptyArrays\": true }}"),
279+
result.getAggregateOperations().get(0));
280+
Assertions.assertEquals(
281+
BsonDocument.parse(
282+
"{\"$match\": {\"$or\": ["
283+
+ "{\"array.field\": {\"$exists\": true}}, "
284+
+ "{\"array.field1\": {\"$exists\": true}}, "
285+
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
286286
result.getAggregateOperations().get(1));
287287
Assertions.assertEquals(
288288
BsonDocument.parse(
@@ -326,19 +326,19 @@ void testOrderByWithMaxRowsAndInnerOrderBy() throws SQLException {
326326
Assertions.assertNotNull(result);
327327
Assertions.assertEquals(5, result.getColumnMetaData().size());
328328
Assertions.assertEquals(4, result.getAggregateOperations().size());
329-
Assertions.assertEquals(
330-
BsonDocument.parse(
331-
"{\"$match\": {\"$or\": ["
332-
+ "{\"array.field\": {\"$exists\": true}}, "
333-
+ "{\"array.field1\": {\"$exists\": true}}, "
334-
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
335-
result.getAggregateOperations().get(0));
336329
Assertions.assertEquals(
337330
BsonDocument.parse(
338331
"{ \"$unwind\": {"
339332
+ "\"path\": \"$array\", "
340333
+ "\"includeArrayIndex\" : \"array_index_lvl_0\", "
341334
+ "\"preserveNullAndEmptyArrays\": true }}"),
335+
result.getAggregateOperations().get(0));
336+
Assertions.assertEquals(
337+
BsonDocument.parse(
338+
"{\"$match\": {\"$or\": ["
339+
+ "{\"array.field\": {\"$exists\": true}}, "
340+
+ "{\"array.field1\": {\"$exists\": true}}, "
341+
+ "{\"array.field2\": {\"$exists\": true}}]}}"),
342342
result.getAggregateOperations().get(1));
343343
Assertions.assertEquals(
344344
BsonDocument.parse(

common/src/main/resources/jdbc.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ MISMATCH_SCHEMA_NAME=Given schema name '%s' does not match stored schema name '%
8181
QUERY_CANNOT_BE_CANCELED=Cannot cancel query: %s.
8282
QUERY_IN_PROGRESS=Cannot execute query, another query is already in progress.
8383
QUERY_NOT_STARTED_OR_COMPLETE=Cannot cancel query, it is either completed or has not started.
84-
AUTHORIZATION_ERROR=Authorization failed for user '%s' on database '%s' with mechanism '%s'.
84+
AUTHORIZATION_ERROR=Invalid username or password or user is not authorized on database '%s'. Please check your settings. Authorization failed for user '%s' on database '%s' with mechanism '%s'. Please check username, password, database and authorization for the user.
8585
# SECURITY_ERROR error is provided by the driver
8686
SECURITY_ERROR=Security error detected: '%s'.
8787
SINGLE_EQUIJOIN_ONLY=Only a single equality condition is supported for joining tables from different collections. Please refer to the list of the supported features.

src/main/java/software/amazon/documentdb/jdbc/DocumentDbConnection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ private void pingDatabase(final int maxTimeMS) throws SQLException {
302302
SqlState.CONNECTION_EXCEPTION,
303303
e,
304304
SqlError.AUTHORIZATION_ERROR,
305+
mongoDatabase.getName(),
305306
e.getCredential().getUserName(),
306307
e.getCredential().getSource(),
307308
e.getCredential().getMechanism());

src/markdown/support/troubleshooting-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ The online security resources may give a pointer how to fix this.
132132
### Invalid username or password
133133

134134
#### What to look for:
135-
- `Authorization failed for user '<username>' on database 'admin' with mechanism 'SCRAM-SHA-1'.`
135+
- `Invalid username or password or user is not authorized on database '<database>'. Please check your settings. Authorization failed for user '<username>' on database 'admin' with mechanism 'SCRAM-SHA-1'.`
136136
- `Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='<username>', source='admin', password=<hidden>, mechanismProperties=<hidden>}'.`
137137

138138
#### What to do:

0 commit comments

Comments
 (0)