och5351 commented on code in PR #183:
URL:
https://github.com/apache/flink-connector-jdbc/pull/183#discussion_r2696299144
##########
flink-connector-jdbc-core/src/test/java/org/apache/flink/connector/jdbc/core/database/catalog/AbstractJdbcCatalogTest.java:
##########
@@ -27,16 +27,33 @@ class AbstractJdbcCatalogTest {
@Test
void testJdbcUrl() {
- AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234/");
- AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234");
+
AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234/db", "db");
+
AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234/db", null);
+ AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234/",
"db");
+ AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234",
"db");
Review Comment:
Hi @RocMarshal!
I've added the error messages as you mentioned.
Here are some example scenarios:
```java
@Test
void TestInvalidJdbcUrl() {
AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234/db",
"db2");
AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234/db?option=1",
"db2");
AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234?option=1",
null);
AbstractJdbcCatalog.validateJdbcUrl("jdbc:dialect://localhost:1234/?option=1",
null);
}
```
The error messages are as follows:
When a database name is missing:
`No default database specified. Please set a database name.`
When the database name is not uniquely specified:
```
Cannot uniquely identify the database name.
Please specify a database name using one of these methods:
(1) Match 'default-database' and database name in 'base-url'.
(2) Use only 'default-database' without database name in 'base-url'.
(3)Omit 'default-database' and include database name in 'base-url'.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]