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

SqlConnectionOptions.fromUri() #767

Closed
gavinking opened this issue Sep 17, 2020 · 13 comments
Closed

SqlConnectionOptions.fromUri() #767

gavinking opened this issue Sep 17, 2020 · 13 comments
Assignees
Milestone

Comments

@gavinking
Copy link

Currently we have the useful method Pool.pool() which automatically selects the driver based on the concrete class of the given SqlConnectOptions.

But I would like a method SqlConnectionOptions.fromUri(), which automatically constructs the right type of SqlConnectOptions based on the scheme of the given URI.

(It would delegate to PgConnectOptions.fromUri(), etc.)

@gavinking
Copy link
Author

@vietj @aguibert any reactions to this suggestion? Thanks

@aguibert
Copy link
Member

I like the idea, but in order for that to work the generic SqlConnectOptions to delegate to an implementation we would need a service loader mechanism first, similar to what is proposed in this PR: #644

@gavinking
Copy link
Author

OK, I see.

@vietj
Copy link
Member

vietj commented Oct 21, 2020

what kind of URI are we talking there ?

PgConnectOptions.fromUri() supports the URI format specified here https://www.postgresql.org/docs/9.3/libpq-connect.html

@gavinking
Copy link
Author

@vietj Right, the same URI format. I'm saying I would like a single method that automatically distinguishes the driver type based on the format of that URL.

@vietj
Copy link
Member

vietj commented Oct 22, 2020 via email

@gavinking
Copy link
Author

do other databases have similar URI ?

Yup, at least the ones you support, and Vert.x already has methods for handling them. :-)

@gavinking
Copy link
Author

(See MySQLConnectionUriParser, DB2ConnectionUriParser, PgConnectionUriParser.)

@pmlopes
Copy link
Contributor

pmlopes commented Oct 30, 2020

I don't know about databases but the official registry (IANA)

https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml

does have entries for redis and mongodb for example. The new redis client refers to it and the url format of the connection string follows the iana spec.

@vietj
Copy link
Member

vietj commented Oct 30, 2020

I don't mind an SPI, however there is already an SPI and I would like to avoid the proliferation of SPI for a feature that seem to be the same, i.e we should reuse the same SPI or have a way to reduce one SPI usage to the other.

@vietj vietj self-assigned this Oct 30, 2020
@vietj
Copy link
Member

vietj commented Oct 30, 2020

Something similar like SqlConnectOptions Driver#fromUri(String uri) that returns either null or the option could reuse the existing SPI.

@vietj vietj removed their assignment Oct 30, 2020
@vietj vietj added this to the 4.0.0 milestone Nov 22, 2020
@vietj vietj modified the milestones: 4.0.0, 4.0.1 Dec 7, 2020
@vietj vietj modified the milestones: 4.0.1, 4.0.3 Feb 5, 2021
@vietj vietj modified the milestones: 4.0.3, 4.0.4 Mar 15, 2021
@vietj vietj modified the milestones: 4.0.4, 4.1.0 Mar 30, 2021
@tsegismont tsegismont self-assigned this Apr 27, 2021
@vietj vietj modified the milestones: 4.1.0, 4.1.1, 4.2.0 Jun 1, 2021
@tsegismont tsegismont modified the milestones: 4.2.0, 4.2.1 Oct 11, 2021
@vietj vietj modified the milestones: 4.2.1, 4.2.2 Nov 3, 2021
@tsegismont tsegismont modified the milestones: 4.2.2, 4.3.0 Dec 13, 2021
@tsegismont
Copy link
Contributor

@vietj hasn't this been solved by #1101 ?

@vietj
Copy link
Member

vietj commented Dec 13, 2021

indeed good catch

@vietj vietj closed this as completed Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants