Knowledgebase
Appeon Web - can the INI file be used to connect to the DB like PB does?
Posted by Carmina Garcia on 12 July 2013 05:20 PM

We have several transaction on current PB application and use INI file to determine which database is selected from user.
Is “Connection Cache” mandatory to connect database ?
If it is, How can we change database server dynamically ? ( We have different physical Database Server )
Is it possible to change all transaction parameters Dynamically by PowerBuilder Script (using INI) with “Connection Cache” ?
Can we use only the INI file without “Connection Cache” like PowerBuilder ?

You cannot use INI file only but you must use the connection cache to connect to the database. Also you must pre-configure the database host and the database name and port that are used to connect to the database. 

Below are the parameters of the transaction object:

SQLCA.DBMS = "OLE DB" //This property corresponds to the Connection Type of Connection Cache. 

SQLCA.LogPass = “appeon” // This property corresponds to the password of Connection Cache. And if you set dynamic database connection of connection cache property is on in the Appeon for .NET version, Appeon can support Logid and logpass of transaction property. For example, 

sqlca.logid = sle_1.text; sqlca.logpass=sle_2.text.
SQLCA.LogId = "sa" // This property corresponds to the user name of Connection Cache.

SQLCA.AutoCommit = False

SQLCA.DBParm = "PROVIDER='SQLOLEDB',DATASOURCE='localhost',PROVIDERSTRING='database='test''"// This property corresponds to the database host and database name of Connection Cache. 

If you are using the Appeon for .NET version, you can reach this goal by using Dynamic transaction object; please go to AEM > Server Properties > Connection Cache and add many connection caches to connect to each database used in your application, then you can connect different databases by using the PB script as below (CacheName is the connection cache name which you configured in AEM):

String ls_dbname
Choose case ls_dbname
Case ‘…’
SQLCA.DBMS = "OLE-MSS"
SQLCA.DBParm="CacheName='sqlserver1' 
Case ‘…’
SQLCA.DBMS = "OLE-MSS"
SQLCA.DBParm="CacheName='sqlserver2'"
End choose

For further details, please refer to the Appeon Help > Appeon Server Configuration Guide for .NET > Database Connection Setup > Setting up transaction object to connection cache mapping > Dynamic transaction object to connection cache mapping page.

(0 vote(s))
Helpful
Not helpful

Comments (0)
Help Desk by Novalys