Okay - it's working, but only when run locally - on my mobile phone I get the following issue (screenshot no.1)
connection:CacheName='quarry'
Connection cache name cannot be null.
The user selects the industry type, then I put that into a global string to do a choose case to determine database connection parameters (see below).
choose case gs_industry
case "Quarry"
sqlca.DBMS = "ODB-ASA"
sqlca.userid = "dba"
sqlca.dbpass = "sql"
sqlca.database = "jpe"
sqlca.dbparm = "CacheName='quarry' ConnectString='DSN=jpe;UID=dba;PWD=sql'"
case "Waste"
sqlca.DBMS = "ODB-ASA"
sqlca.userid = "dba"
sqlca.dbpass = "sql"
sqlca.database = "regen"
sqlca.dbparm = "CacheName='waste' ConnectString='DSN=regen;UID=dba;PWD=sql'"
case else
return
end choose
I then have in my AEM the two data objects (see screenshot 2)
You'll also see I have my sql anywhere 16 data sources tested and working fine (see screenshot 3)
After I choose my case, I then do a CONNECT USING sqlca; and select the username from the database.
CONNECT using sqlca;
IF sqlca.sqlcode = 0 THEN
SELECT string1 INTO :ls_name FROM base WHERE file = -21 AND code = :ls_code USING sqlca;
st_name.text = ls_name
ELSE
MessageBox("ERROR:database connection:" + sqlca.dbparm, sqlca.sqlerrtext)
END IF
DISCONNECT using sqlca;
This is now working when I run locally, I know I am able to collect a unique username in each database depending on which industry I choose.