Dynamic connection to the database: Here we create a buffet for INI file system.ini, write as follows in the System.ini file:
[DBMS_PROFILES] CURRENT = ODBC PROFILES = [Profile] DBMS = Database = UserId = DatabasePassword = LogPassword = ServerName = LogId = Lock = DbParm = ConnectString = 'DSN = ora8; UID =; PWD =' // ora8 database server name refers Prompt = 0 AutoCommit = 0
This is written under the OPEN event of the application: String Ls_iniFile
LS_INIFILE = "System.ini"
// Profile system SQLCA.DBMS = ProfileString (ls_inifile, "Database", "DBMS", "") SQLCA.database = ProfileString (ls_inifile, "Database", "database", "") SQLCA.userid = ProfileString (ls_inifile, "Database", "UserID", "") sqlca.dbpass = profilestring (ls_inifile, "database", "dbpass", "") sqlca.logid = ProfileString (LS_INIFILE, "Database", "LogID", "") SQLCA .LogPass = ProfileString (ls_inifile, "Database", "LogPassWord", "") SQLCA.ServerName = ProfileString (ls_inifile, "Database", "ServerName", "") SQLCA.DBParm = ProfileString (ls_inifile, "Database", " DBPARM "," ")
CONNECT USING SQLCA; Open (w_frame) if Sqlca.sqlcode <> 0 THEN MessageBox ("Cannot Connect to Database", Sqlca.sqlerrtext) Return End IF
***** Code test passed PB8.0