Re: special character in db password


Daniel Mikusa
 

On Tue, Sep 29, 2015 at 11:15 PM, Naga Rakesh <nagarakesh4(a)gmail.com> wrote:

Hello,

I am facing an issue while bounding app to a service instance. The service
instance points to a database which has a '@' (at symbol) in its password
(example : abc(a)def). When I bind this service instance to an existing
app, the app throws up the following error when trying to access the data.
How did you create this service instance? Is it from a service broker? or
is it a user provided service?



*OUT java.net.UnknownHostException: null: unknown error*
*at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method).*

The sample URI in the env formed was "mysql://username:abc(a)def@
1.1.1.1:3306/dbname", as you can see the password was having a '@'
character in it. I believe how it works is it parses the URI as
*drivername://username:password(a)hostname:port/dbname* and in this case as
the password contains @ it is unable to parse the hostname correctly.
That's because the URL is not valid. Your "@" in the password should be
url encoded (the username and password sections should both be urlencoded,
the "@" is just the only character that would change from being
urlencoded).

If you're passing this URL through a user provided service then you need to
manually urlencode it. If you're using a service broker, then that sounds
like a bug with the broker.

Dan

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.