From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Egashira, Yusuke <egashira.yusuke@jp.fujitsu.com>
To: Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Question about password character in ECPG's connection string
Date: Wed, 28 Aug 2019 06:59:44 -0700
Message-ID: <d9b3700d-40bd-1229-2e26-167fafab5c8a@aklaver.com> (raw)
In-Reply-To: <848B1649C8A6274AA527C4472CA11EDD5FC76A28@G01JPEXMBYT02>
References: <848B1649C8A6274AA527C4472CA11EDD5FC70CBE@G01JPEXMBYT02>
<edb3a9df78da4afe744afd7aacd3684ea96dc394.camel@eppesuigoccas.homedns.org>
<848B1649C8A6274AA527C4472CA11EDD5FC76A28@G01JPEXMBYT02>
On 8/27/19 6:18 PM, Egashira, Yusuke wrote:
> Hi, Giuseppe,
>
> Thanks to response to my question!
>
>> It seems to me that ECPG documentation does not allow specifying
>> username and/or password in the connection string. The correct syntax
>> should be:
>>
>> EXEC SQL CONNECT TO "unix:postgresql://localhost/connectdb" USER
>> "myuser" IDENTIFIED BY "pass&word"
>
> Yes, I could connect to database with "USER" and "IDENTIFIED BY" phrase in CONNECT statement.
> However, I could also connect to database with password in connection string when my password does not contains '&' character.
>
> 1. In database,
> > CREATE ROLE myuser LOGIN PASSWORD 'password';
> 2. In ECPG application,
> EXEC SQL CONNECT "tcp:postgresql://localhost?user=myuser&password=password";
> -> The connection was succeeded.
>
> This behavior confuse me.
My guess it that what is happening is:
1) Given password: my&pwd
2) "tcp:postgresql://localhost?user=myuser&password=password" looks like
"tcp:postgresql://localhost?user=myuser&password=my&pwd"
and password is parsed on the & and you also end up with an extra
parameter pwd
Have you tried quoting the password?
>
> If user and password cannot write in connection string, what are parameters allowed in "connection_option" ?
> I hope I can get this information from the ECPG documentation.
>
> Regards.
>
> --
> Yusuke, Egashira.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, egashira.yusuke@jp.fujitsu.com, giuseppe@eppesuigoccas.homedns.org
Subject: Re: Question about password character in ECPG's connection string
In-Reply-To: <d9b3700d-40bd-1229-2e26-167fafab5c8a@aklaver.com>
References: <848B1649C8A6274AA527C4472CA11EDD5FC70CBE@G01JPEXMBYT02> <edb3a9df78da4afe744afd7aacd3684ea96dc394.camel@eppesuigoccas.homedns.org> <848B1649C8A6274AA527C4472CA11EDD5FC76A28@G01JPEXMBYT02> <d9b3700d-40bd-1229-2e26-167fafab5c8a@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox