ragtime icon indicating copy to clipboard operation
ragtime copied to clipboard

allow URL-unsafe characters inside raw JDBC connection-uri

Open gerrit-hntschl opened this issue 11 years ago • 9 comments

ragtime.core/connection tries to parse the raw-connection-string as a URI which fails if the string contains unsafe characters like %. Our password contained such characters which lead to java.net.URISyntaxException: Malformed escape pair ... when trying to run lein ragtime migrate. Not sure if proposed fix is a hack, otherwise unsafe characters would have to be percent-encoded inside the project.clj/profiles.clj and parsed inside ragtime, which only adds confusion IMHO.

Cheers!

gerrit-hntschl avatar Apr 08 '14 09:04 gerrit-hntschl

What happens when the password is percent-encoded? In theory JDBC should be decoding any percent-encoded passwords.

weavejester avatar Apr 08 '14 14:04 weavejester

Received an error because of AUTHENTICATION FAILED and so on. Didn't dig a lot deeper though.

gerrit-hntschl avatar Apr 08 '14 15:04 gerrit-hntschl

What database are you using?

weavejester avatar Apr 08 '14 15:04 weavejester

Actually calling (map->SqlDatabase {:connection-uri url}) with the url containing the unencoded % worked just fine.

gerrit-hntschl avatar Apr 08 '14 15:04 gerrit-hntschl

PostgreSQL

gerrit-hntschl avatar Apr 08 '14 15:04 gerrit-hntschl

Which version of Postgres?

weavejester avatar Apr 08 '14 15:04 weavejester

9.3.3 and driver [postgresql "9.1-901-1.jdbc4"]

gerrit-hntschl avatar Apr 08 '14 15:04 gerrit-hntschl

Okay, I'll run some tests when I get a spare minute. I want to ensure that Postgres really does handle URLs incorrectly before adding any hacks to get around this.

In the meantime, you can use map->SqlDatabase, correct?

weavejester avatar Apr 08 '14 15:04 weavejester

Yeah, we just changed the password :see_no_evil: so we can use lein ragtime migrate during deployments.

Thanks!

gerrit-hntschl avatar Apr 08 '14 15:04 gerrit-hntschl