1. Sivaprakash BKR
  2. PowerBuilder
  3. Monday, 11 December 2017

Hello,

PB 2017, Postgresql 10.1

I want to connect to postgresql without creating any DSN, which didn't succeed with the following code.

Sqlca.DBMS =ODBC
Sqlca.DBParm="Driver={PostgreSQL ODBC Driver(UNICODE)};DATABASE=db;SERVER=192.168.x.x;PORT=5432;UID=postgres;PWD=pass";

 
With DSN it works fine. Would like to connect without DSN.  Couldn't understand where the problem lies.
 

Happiness Always
BKR Sivaprakash

René Ullrich Accepted Answer Pending Moderation
0
Votes
Undo

I use ConnectString='DRIVER=PostgreSQL Unicode;...' and it works for me.

You have to register the driver dlls as Marco wrote.

Have you tried to remove the { } in your DRIVER statement?

Comment
Thanks Rene Ullrich.  It's working, after removing the { } braces.   I tried all other combinations, except the curly braces.  Thanks.



Happiness Always

BKR Sivaprakash



 

  1. Sivaprakash BKR
  2. Monday, 11 December 2017
There are no comments made yet.
  1. Monday, 11 December 2017
  2. PowerBuilder
  3. # 1
Marco Meoni Accepted Answer Pending Moderation
0
Votes
Undo

Hello Sivaprakash,
A DSN in ODBC Datasource Administrator is just a bunch of Windows Registry settings.
You need to set these settings when the PB application starts (and maybe remove what it closes).
Here below what you need (check that key name and value in the first two RegistrySet correspond to the version on your DEV machine):

RegistrySet("HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\PostgreSQL ODBC Driver(UNICODE)", "Driver", RegString!, "PSQLODBC.dll")
RegistrySet("HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\PostgreSQL ODBC Driver(UNICODE)", "Setup", RegString!, "PSQLODBC.dll")
RegistrySet("HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC Drivers", "PostgreSQL ODBC Driver(UNICODE)", RegString!, "Installed")

Then you can keep the sqlca.odbc and sqlca.dbparm settings before the CONNECT.
Cheers,
Marco

Comment
Thanks Marco Meoni.



I've already installed the driver and those registry settings are available.  Only change being the dll file name is set to  psqlodbc35w.dll instead of psqlodbc.dll.



Creating a DSN and connecting it works fine.   Trying to connect without creating a DSN.  Want to avoid creating a DSN every time in every computer (at client place).



Happiness Always

BKR Sivaprakash



 

  1. Sivaprakash BKR
  2. Monday, 11 December 2017
The program could create the DSN settings in the registry if missing prior to connecting.

  1. Roland Smith
  2. Monday, 11 December 2017
There are no comments made yet.
  1. Monday, 11 December 2017
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.