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

There is no convenient way to connect to YDB in Y.Cloud via JDBC using connection url in IDE #14

Open
pnv1 opened this issue Sep 30, 2021 · 0 comments

Comments

@pnv1
Copy link
Collaborator

pnv1 commented Sep 30, 2021

The cause of the problem:
Y.Cloud uses iam authentication for all of its services, including YDB.
There is a separate project "auth-iam" in YDB SDK repository for iam authentication. YDB core does not depend on it. Neither does JDBC. JDBC has only default token authentication. To use iam authentication in jdbc there is an opportunity to set custom authProvider in the code of a user application. Example:
https://github.com/yandex-cloud/ydb-java-sdk/blob/master/jdbc/examples/basic_example/src/main/java/com/yandex/ydb/jdbc/example/Main.java#L46

But when you use JDBC in IDEs all you can set is a connection url with a list of key-value string properties.

Solution:
Probably a new jdbc jar that has iam authentication options in connection url.

Workaround:
You can get iam token (yc iam create-token) and use it as a token in JDBC's connection url:
jdbc:ydb:<endpoint>?database=<database>&token=<iam-token>&secureConnection=true
Note that iam-token expires in around 10 hours, so its a temporary solution.

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

No branches or pull requests

1 participant