postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
[postgresql-interfaces/psqlodbc] issue #138: MS Access and postgresODBC: connection string changes
2+ messages / 1 participants
[nested] [flat]

* [postgresql-interfaces/psqlodbc] issue #138: MS Access and postgresODBC: connection string changes
@ 2025-10-16 09:26  "fjf2002 (@fjf2002)" <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: fjf2002 (@fjf2002) @ 2025-10-16 09:26 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

Hello,
I am using MS Access with postgresODBC and I'm not sure which of both is responsible for the following behaviour.
However I **did not** experience this behaviour in the past with MS SQL Server.

### Experienced behaviour:
* The connection string changes when VBA `db.TableDefs.Append` is called.
* However it does not change when `tableDef.RefreshLink` is called

### Expected behaviour:
The connection string shall not change.

### Remark 1
I am using the parameters BoolsAsChar=0 and TrueIsMinus1=1, thus **NOT USING** their default value, cf.
* https://odbc.postgresql.org/docs/config-opt.html
* https://www.enterprisedb.com/docs/odbc_connector/latest/05_edb-odbc_connection_properties/

I could somehow imagine that the connection string is being transformed into a canonical form, perhaps omitting properties that use default values.
However this is not the case:
* BoolsAsChar=0 and TrueIsMinus1=1 are not the default values
* Neither BoolsAsChar/TrueIsMinus1 nor their short equivalents B9/C6 occur in the changed connection string.


### Remark 2
This ticket is just about the connection string changing. But what properties really apply to the connection?
I suspected the ORIGINAL connection string properties, NOT the changed ones.

### Remark 3
I even had problems about MS ACCESS connecting to the **WRONG** Postgres Server.
I had two Postgres Servers running on the same host on different ports.
But currently I cannot reproduce that.


### Test Case
```vba
Sub testConnString()
    Const connString = "ODBC;DRIVER={PostgreSQL UNICODE};Server=myserver;Port=5433;Database=pvz;sslmode=require;Trusted=true;BoolsAsChar=0;TrueIsMinus1=1;pqopt={application_name=bar.accdb}"
    
    Dim db As Database: Set db = CurrentDb
    Dim td As tableDef: Set td = db.CreateTableDef
    td.name = "foo"
    td.sourceTableName = "foo"
    td.connect = connString
    db.TableDefs.Append td
    
    Debug.Print db.TableDefs("foo").connect
    ' prints:
    ' ODBC;DRIVER={PostgreSQL UNICODE};DATABASE=pvz;SERVER=myserver;PORT=5433;UID=myuser;PWD=;CA=r;A7=100;B0=255;B1=8190;BI=0;C2=;D5={application_name=bar.accdb};D6=-101;CX=1c381008b;A1=7.4
    ' what the heck!?
    
    db.TableDefs("foo").RefreshLink
    Debug.Print db.TableDefs("foo").connect ' still prints the changed connection string
    
    db.TableDefs("foo").connect = connString
    Debug.Print db.TableDefs("foo").connect ' now prints connString
    
    db.TableDefs("foo").RefreshLink
    Debug.Print db.TableDefs("foo").connect ' still prints connString
End Sub
```

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [postgresql-interfaces/psqlodbc] issue #138: MS Access and postgresODBC: connection string changes
@ 2025-11-03 13:48  "fjf2002 (@fjf2002)" <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: fjf2002 (@fjf2002) @ 2025-11-03 13:48 UTC (permalink / raw)
  To: postgresql-interfaces/psqlodbc <[email protected]>

Any activities here?

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-11-03 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-10-16 09:26 [postgresql-interfaces/psqlodbc] issue #138: MS Access and postgresODBC: connection string changes "fjf2002 (@fjf2002)" <[email protected]>
2025-11-03 13:48 Re: [postgresql-interfaces/psqlodbc] issue #138: MS Access and postgresODBC: connection string changes "fjf2002 (@fjf2002)" <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox