Closed electricmonk closed 9 years ago
Thanks for raising this issue.
So far I have been trying to follow rfc3986 and JDBC URLs do not adhere to that spec. Maybe we could make a separate JdbcUriParser
, and I will rename the current UriParser to Rfc3986Parser
. To start they could be exactly the same, except for the scheme.
From rfc3986:
Scheme names consist of a sequence of characters beginning with a letter and followed by any combination of letters, digits, plus ("+"), period ("."), or hyphen ("-")
From the JDBC 4 spec:
Note - A JDBC URL is not required to fully adhere to the URI syntax as defined in RFC 3986, Uniform Resource Identifier (URI): Generic Syntax.
I will also need to add digits, +
, .
and -
to the existng UriParser
as that seems to have been missed.
Glad to be of help. In the mean time I'm using java.net.URI but I hate myself for doing that - would love to see this resolved eventually :)
Ah, we just ran into this same issue also. Would be great to include JDBC url support.
My opinion, after looking at some sample JDBC connection "URL"s is that they are not suitable for parsing with this library as they are not at all standardised.
You could build a library to do it, it would need to recognise the "jdbc:" prefix then delegate the rest of the parsing to the parser that matches the next prefix (e.g. "oracle:" or other vendors) which may again need to delegate to a different parser for the next prefix (e.g. "thin:" or "oci:" for oracle) to comprehend the rest of the string.
The best thing to do is to stop calling them "URL" and start calling them "Connection string"
@philwill-nap makes a good point. Closing this.
When parsing a JDBC url:
it is being parsed as a relative url. This is because in
UrlParser
, the_scheme
rule expects the scheme part to be alphanumeric.Ideally, you could relax the parser a bit to allow for colons, thus supporting JDBC urls as well.