Resolution:
Mark Goldsmith noticed that I was storing double quotes with the connection string information.
Removing the stored double-quotes solved the problem!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PB2019R3
Dear Appeon:
Internally in PB2019R3, what is the difference between a hard-coded string in the application, and a string variable that is created in script?
Example:
1) I have a hard-coded string in gnv_appmgr.pfc_logon_env. When the code looks like this, a connection is made to the PostgreSQL database without prompting me for a DSN. This is the behavior I expect. Note the hardcoded value is set to sqlca.dbparms at the bottom of the snippet.
SQLCA.AutoCommit = False
SQLCA.Database = ""
SQLCA.DBMS = ls_dbms
SQLCA.DBParm = ""
SQLCA.LogId = as_userid
SQLCA.LogPass = as_password
SQLCA.ServerName = ls_ip_addr
SQLCA.DBParm = "ConnectString='Driver=PostgreSQL Unicode;Database=nttest;Server=10.50.68.244;Port=5444;UID=cabdevusr;PWD=cabdevusr;',DisableBind=1,UseServerSidePrepare=1,PBCatalogOwner='chadba',StripParmNames='Yes'"
2) When the DBPARM string is constructed (or read into the app) and CONNECT is called, I am prompted for a DSN.
// Get the connect string to be updated
ls_DBParm = "ConnectString='Driver=<driver>;Database=<db>;Server=<ip>;Port=<port>;UID=<userid>;PWD=<password>;'
Each token encased in angle brackets is then replaced, item by item. The resulting string is identical to the hard-coded string, but it prompts for a DSN when the CONNECT is called.
3) I put the hard-coded connection string into the Registry, read it into the app, and used that string in SQLCA.DBPARMS, and I was prompted for a DSN.
ls_key = "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\CSGI\Logon\DBMS\PostgreSQL\nttest_PG"
RegistryGet (ls_key, "sqlca_dbparms", RegString!, ls_DBParm)
SQLCA.AutoCommit = False
SQLCA.Database = ""
SQLCA.DBMS = ls_dbms
SQLCA.DBParm = ls_DBParm
SQLCA.LogId = as_userid
SQLCA.LogPass = as_password
SQLCA.ServerName = ls_ip_addr
//---------- DEBUG -----------------------
ls_DBParm = "ConnectString='Driver=PostgreSQL Unicode;Database=nttest;Server=10.50.68.244;Port=5444;UID=cabdevusr;PWD=cabdevusr;',DisableBind=1,UseServerSidePrepare=1,PBCatalogOwner='chadba',StripParmNames='Yes'"
Here's the actual code. This is the ONLY way I have been able to connect without being prompted for a DSN.
- Olan Knight
- PowerBuilder
- Tuesday, 15 June 2021 20:35 PM UTC
- Page :
- 1
There are no replies made for this question yet.
However, you are not allowed to reply to this question.
However, you are not allowed to reply to this question.
Too many double quotes were spoiling the string. Getting rid of them solved the problem!
THANK YOU!