cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Singaravelan
Level 4

Is it possible to list oracle users in the Installshield window?

Hi all,

We are using MSI project to execute SQL Scripts in the Oracle DB.

We would like to list the active users in the Installshield window itself before initiating the actual installation.

I guess that we need to use a custom action similar to the SQL server display list of databases. But would it work for the list of users?

Any pointer or help is highly appreciated.

Best Regards
Singaravelan
Labels (1)
0 Kudos
(5) Replies
azad_khan
Level 4

You can use the below query for getting list of database from a particular user this is what I done for my requirement.


select count(*) from pg_database where datdba in(select usesysid from pg_user where usename='astuser') and lower(datname) like '%_backup';
select replace(replace(replace(datname,'_Backup',''), 'CONFY_V_','ConFY V ') ,'_','.')as datname from pg_database where datdba in(select usesysid from pg_user where usename='astuser') and lower(datname) like '%_backup';

You need to run this with LaunchAppndwait command from installshield
before that create a batch file to run this query.

You can display the list in combo box in installshield window.

Hope this may help you.
0 Kudos
Singaravelan
Level 4

Thanks very much Azad for your reply and the query.

However I have the following problems.

I need to show the list of users during the Installshield User Interface stage itself and not during the execution.

Moreover I need to pass the SQL DB and Parameters, which we capture in the installshield interface to the Launchappandwait program.

Assuming this is fine (am starting to work on your suggestion), how do we map it to the Installshield interface to show the list of users as you mentioned in the combo?

Best Regards,
Velan
0 Kudos
azad_khan
Level 4

For displaying list in Combo Box u need to add a diaogue, Add u need to add the property of that Combo Box in property manager.

Below is the code which I did for my project.

function ListDataBase(hMSI)
string Sample ,svLine,DatabaseFolder, svline, svString,Parameter ;
string folder,copydbfile, migdbsqlfile,migdbbatfile,dbtextfilepath,TempDelete, copydbtextfile, copydbfilepath, svValue,Visible ;//dbbatfilepath
NUMBER nvfileHandle, ListID, ComboBox;
NUMBER nvFileHandle, Count , order , hDatabase, hView, Count_DataBase, dCount;
LIST listID; HWND hRec;
begin
Count =1 ;
//nCount = 1;
order = 1;
dCount = 1 ;
listID = ListCreate (STRINGLIST);
Parameter=Arguments;
LaunchAppAndWait(ChangeUser,Parameter,WAIT|LAAW_OPTION_HIDDEN);
LaunchAppAndWait (BatchFilePath_0, Parameter,WAIT|LAAW_OPTION_HIDDEN);
DatabaseFolder= TempFolder^PRODUCT_GUID;//+"\\PostgresScripts_1.cmd"
OpenFileMode (FILE_MODE_APPEND);
OpenFile(nvFileHandle,DatabaseFolder,"ListDataBase.txt") ;
while (Count <= 3)
GetLine (nvFileHandle,svline);
Count = Count + 1;
endwhile;
StrToNum ( Count_DataBase, svline );
if(Count_DataBase=0)then
MsiSetProperty(hMSI,"BackupAvailable","False");
MsiSetProperty(hMSI,"IS_SQL_DATABASE","Install New Database");
else
Count_DataBase = Count_DataBase+3 ;
Count =1;
while (Count<=Count_DataBase)
GetLine (nvFileHandle, svLine);
ListAddString (listID, svLine, AFTER);
hRec = MsiCreateRecord(4);
MsiRecordSetString(hRec, 1, "IS_SQL_DATABASE"); // Column1: Property tied to the entry
MsiRecordSetInteger(hRec, 2, order); // Column2: Display order of the item
MsiRecordSetString(hRec, 3, "Install New Database");//.Name); //Column3: Value to set property to
MsiRecordSetString(hRec, 4,"Install New Database");//.Name);
listID = MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRec);
listID = MsiCloseHandle(hRec);
MsiSetProperty(0,"IS_SQL_DATABASE","Install New Database");
if (Count >= 4 ) then
order = order + 1;
hRec = MsiCreateRecord(4);
MsiRecordSetString(hRec, 1, "IS_SQL_DATABASE"); // Column1: Property tied to the entry
MsiRecordSetInteger(hRec, 2, order); // Column2: Display order of the item
MsiRecordSetString(hRec, 3, svLine);//.Name); //Column3: Value to set property to
MsiRecordSetString(hRec, 4, svLine);//.Name); //Column4: Display text for item
listID = MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRec);
listID = MsiCloseHandle(hRec);
endif ;
listID = MsiDatabaseOpenView(hDatabase, "SELECT * FROM ComboBox WHERE Property='IS_SQL_DATABASE'", hView);
listID = MsiViewExecute(hView,NULL);
Count = Count+1;
endwhile;
CloseFile (nvFileHandle);
ListDestroy (listID);
MsiSetProperty(hMSI,"BackupAvailable","True");
endif;
end ;


Hope this may give to some help...
0 Kudos
Singaravelan
Level 4

Thanks once again Azad. A short q - Where do I need to add this Function?

Best Regards,
Velan
0 Kudos
azad_khan
Level 4

You need to add this function in Installscript and include it in Custom Action and Sequences.
0 Kudos