1. Olan Knight
  2. PowerBuilder
  3. Friday, 21 August 2020 15:47 PM UTC

PB2019R2
Windows10 64 bit platform
PostgreSQL 10 driver installed
PostgewSQL 10 database named "dev12c"

Summary
Q:  How can I stop the "Select Data Source" popup window from being displayed every time a
     CONNECT statement is called?


Background
I installed a DSN in order to connect to the PG database from the PB2019R2 IDE - and it worked.

Details
I am now running the application from the IDE to the same database using the DSN-less connection posted by Sivaprakash BKR. Here's what he said:

@ RunTime

SQLCA.DBMS=ODBC
SQLCA.DBParm="ConnectString='Driver=PostgreSQL ODBC Driver(UNICODE);Database=<Database>;Server=<ServerName>;Port=5432;UID=<UserID>;PWD=<Password>;',DisableBind=1"
SQLCA.Lock="RC"
SQLCA.AutoCommit = False

* Substitute <Database>, <ServerName>, <UserID>, <Password> with correct values.



When any CONNECT is called, this dialog box pops up, asking me to select the Data Source.


I scroll down to the PG entry and select it:

Click OK, and it connects successfully.

As I proceed through the code and add another tranasction object, the "Select Data Source" window pops up again when the CONNECT is called.


Thank You,

Olan

 

 

 

Olan Knight Accepted Answer Pending Moderation
  1. Friday, 21 August 2020 21:02 PM UTC
  2. PowerBuilder
  3. # 1

Mike -

   I also tried variations on ls_DBParm = <below> and got SQLDBCode = 999
"ConnectString='Driver=PostgreSQL ODBC Driver(UNICODE);Database=dev12c;Server=10.10.10.243;Port=5444;
UID=cabdevusr;PWD=cabdevusr;',DisableBind=1,UseServerSidePrepare=1,
INIT_PROMPT='DBPROMPT_NOPROMPT',ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'"

   Same error msg when "Server=accdevxd0022.sp.dev.com" and when "Server=server".


   Any time the DBPARM did NOT include the ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT', then the popup would be displayed, I would select the DSN, click OK and the connection was successful.


   The entire SQLCA object looks like this:

    // Set the SQLCA values for an ODBC connection
    SQLCA.DBMS            = "ODBC"
    SQLCA.Lock             = "RC"
    SQLCA.AutoCommit  = FALSE    
    SQLCA.DBParm         = ls_DBParm

    SQLCA.LogPass         = as_password
    SQLCA.LogId            = as_userid
   
    SQLCA.ServerName    = ""            
    SQLCA.LogPass          = ""
    SQLCA.LogId             = ""   

   The goal is to have a DNS-less connection, but I'm wondering if having the DNS entry for use with the PB2019R2 IDE is causing an issue. I cannot image that it would be an issue, but....????


   Any ideas?


Thank You,

Olan

 

Comment
  1. mike S
  2. Saturday, 22 August 2020 12:11 PM UTC
I never use dns for either IDE or the run time application. Its been awhile since i had setup Postgreql and PB to connect. I believe that the 999 means driver name not found and dns name not specified. I vaguely recall having a problem with unicode.

so, I think it may have to do with the driver name not being found. try {PostgreSQL ANSI}; instead of unicode.



  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Friday, 21 August 2020 16:03 PM UTC
  2. PowerBuilder
  3. # 2

try adding noprompt to your connection string?

SQLCA.DBParm="INIT_PROMPT='DBPROMPT_NOPROMPT'" //don't show annoying odbc box on failed passwords

Comment
  1. Olan Knight
  2. Friday, 21 August 2020 19:49 PM UTC
Awesome sauce; I'll give it a try. Thank you!
  1. Helpful
  1. Olan Knight
  2. Friday, 21 August 2020 20:12 PM UTC
Mike -

I tried this and got a failure with a "999 sqlca.sqlDBCode error.



ConnectString='Driver={PostgreSQL UNICODE}; Server=10.10.10.243;Database=dev12c; Port=5444;UID=devusr;PWD=devusr',OJSyntax='UNICODE',StripParmNames='Yes',INIT_PROMPT='DBPROMPT_NOPROMPT',CommitOnDisconnect='No',DelimitIdentifier='No',PBTrimCharColumns='YES',StaticBind=0,DisableBind=1,ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'



It also failed when server=accdevxd0022.sp.dev.com.

  1. Helpful
  1. Olan Knight
  2. Friday, 21 August 2020 20:13 PM UTC
Let's try that ConnectString again:



ConnectString='Driver={PostgreSQL UNICODE}; Server=10.10.10.243;Database=dev12c; Port=5444;UID=devusr;

PWD=devusr',OJSyntax='UNICODE',StripParmNames='Yes',INIT_PROMPT='DBPROMPT_NOPROMPT',

CommitOnDisconnect='No',DelimitIdentifier='No',PBTrimCharColumns='YES',StaticBind=0,DisableBind=1,

ConnectOption='SQL_DRIVER_CONNECT,SQL_DRIVER_NOPROMPT'

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


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