Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-33069]Mysql and Postgres catalog support url extra parameters #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

waywtdcc
Copy link

@waywtdcc waywtdcc commented Sep 11, 2023

Mysql and Postgres catalog support url extra parameters

CREATE CATALOG mymysql WITH(
'type' = 'jdbc',
'default-database' = 'test',
'username' = 'root',
'password' = 'xxx',
'base-url' = 'jdbc:mysql://xxx:53309',
'extra-url-param' = '?characterEncoding=utf8'
);

If used in this way, the URLs of all tables obtained from this catalog are: jdbc:mysql://xxx:53309?characterEncoding=utf8

@boring-cyborg
Copy link

boring-cyborg bot commented Sep 11, 2023

Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html)

@waywtdcc waywtdcc changed the title Mysql and Postgres catalog support url extra parameters [FLINK-33069]Mysql and Postgres catalog support url extra parameters Sep 11, 2023
@waywtdcc
Copy link
Author

@MartijnVisser Hello, can you review this PR when you have time?

@MartijnVisser
Copy link
Contributor

@waywtdcc Why does this need to be an additional parameter?

@waywtdcc
Copy link
Author

waywtdcc commented Nov 8, 2023

@waywtdcc Why does this need to be an additional parameter?

Because sometimes you need to use ?characterEncoding=utf8 similar url parameters to connect to jdbc

@MartijnVisser
Copy link
Contributor

Because sometimes you need to use ?characterEncoding=utf8 similar url parameters to connect to jdbc

But why not just pass these in to the base URL?

@waywtdcc waywtdcc closed this Nov 13, 2023
@waywtdcc waywtdcc reopened this Nov 13, 2023
@waywtdcc
Copy link
Author

Because sometimes you need to use ?characterEncoding=utf8 similar url parameters to connect to jdbc

But why not just pass these in to the base URL?

The real url is a combination of base-url+default-database, so I cannot form the correct url when I add it to base-url. For example, if the base-url is set to jdbc:mysql://xxx:53309?characterEncoding=utf8, then the final real url is jdbc:mysql://xxx:53309?characterEncoding=utf8/test; this is the wrong url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants