From: gzh <gzhcoder@126.com>
To: pgsql-general@lists.postgresql.org
Subject: Re:Does psqlodbc_11_01_0000-x64 support special characters?
Date: Wed, 12 Oct 2022 19:16:18 +0800 (CST)
Message-ID: <4ac56203.71ff.183cbe8d7e2.Coremail.gzhcoder@126.com> (raw)
In-Reply-To: <3a47a8fb.5a22.183cb4f8c61.Coremail.gzhcoder@126.com>
References: <3a47a8fb.5a22.183cb4f8c61.Coremail.gzhcoder@126.com>
I found that the password can't contain the % character, and the other special characters (* , $) are no problem.
At 2022-10-12 16:28:51, "gzh" <gzhcoder@126.com> wrote:
PostgreSQL version: 13.5
Operating system: windows 10
Description:
I wrote a VBA application to connect to PostgreSQL database by psqlodbc.
The application works fine when there are no special characters in the password.
When the password contains special characters (e.g. * , $ %),
the application responds with an error below:
Number: -2147467259
Description: password authentication failed for user 'testdb'
I made an sample as below:
VBA
----------------------------- START ---------------------------------
Sub dbconnTest()
Dim rs As ADODB.Recordset
Dim sql As String
Dim i As Integer
Dim rcnt As Integer
Set cnn = New ADODB.Connection
cnn.Open "Provider=MSDASQL;Driver=PostgreSQL Unicode;UID=postgres;port=5432;Server=localhost;Database=testdb;PWD=Gd*oB,$3Ln%pQ"
Set rs = New ADODB.Recordset
sql = "SELECT * FROM testtbl"
rs.ActiveConnection = cnn
rs.Source = sql
rs.Open
cnt = rs.Fields.Count
rcnt = 2
Do Until rs.EOF
For i = 0 To cnt - 1
Cells(rcnt, i + 1).Value = rs.Fields(i)
Next
rcnt = rcnt + 1
rs.MoveNext
Loop
Set rs = Nothing
Set cnn = Nothing
End Sub
----------------------------- END ---------------------------------
Thanks for any help!
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: gzhcoder@126.com
Subject: Re: Does psqlodbc_11_01_0000-x64 support special characters?
In-Reply-To: <4ac56203.71ff.183cbe8d7e2.Coremail.gzhcoder@126.com>
References: <3a47a8fb.5a22.183cb4f8c61.Coremail.gzhcoder@126.com> <4ac56203.71ff.183cbe8d7e2.Coremail.gzhcoder@126.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