PDA

View Full Version : how to allow user to select Microsoft SQL or Oracle Database



adlibedoc
08-17-2005, 03:16 PM
I need to create a database on either Microsoft SQL Server or Oracle. I want to create a custom dialog which will allow them to choose either Microsoft or Oracle...how then would I connect to either database? Don't see anyway to do this through the IDE...

Exerpt from Help below makes it sound like installshield will just connect to first server possible.

"If you select both database servers, then InstallShield will establish a connection and perform the specified requirement checks on the selected server types based on the sequence of the server types as they appear in the table. In other words, if InstallShield finds a match after checking requirements against the first database server in the list, then a connection and a check will not be done on any selected subsequent database types in the table. The SQL scripts associated with the connection will be installed to that first database server verified."

bhagelin
08-17-2005, 06:42 PM
Maybe you could define both server connections in the SQL scripts view, and then associate each of those connections with different features, say the Oracle feature and the SQL server feature. Then when your user chooses which one they want, you could install that feature, and leave the other feature out.

adlibedoc
08-18-2005, 12:32 PM
installshield still trys to connect to both connections.....

I think I am going to have to code the DB connection manually and use a custom dialog for selection

bhagelin
08-18-2005, 02:49 PM
Ah, that's right InstallShield attempts to establish the connections prior to installing the features.

hidenori
08-18-2005, 04:05 PM
If you are using an InstallScript project, you can skip to establish specific connections at run-time. In OnSQLServerInitialize() event, you can add the code conditioning whether to connect to a SQL server or not.

What you need to do is to test the value of szConnection after you get the connection information from SQLRTGetConnectionInfo( szConnection, szServer, szDB, szUser, szPassword ). The szConnection is the connection name that you have specified in the SQL Scripts view. If you have 2 connections named ORACLE_CONNECTION and MS_CONNECTION in the view and you don't want to establish the ORACLE_CONNECTION connection, your code will look like this:

(The lines highlighted in bold are the code you will need to add)


while (nResult = ISERR_SUCCESS)

//Get Default values for connection
SQLRTGetConnectionInfo( szConnection, szServer, szDB, szUser, szPassword );

if( szConnection = "MS_CONNECTION") then

bWinLogin = SQLRTGetConnectionAuthentication( szConnection );

// Display login dialog (without connection name)
nResult = SQLServerSelectLogin( szServer, szUser, szPassword, bWinLogin );


if( nResult = NEXT ) then

//store data in case we need it again
SQLRTPutConnectionInfo( szConnection, szServer, szUser, szPassword );

//try connection
nResult = SQLRTConnect2( szConnection, szServer, bWinLogin, szUser, szPassword, szDatabaseServer );

if( nResult < ISERR_SUCCESS ) then
.
.
.
else
.
.
//Move on to next connection
nCount++;
bNext = TRUE;
nResult = ListGetNextString(listConnections, szConnection);
endif;
else
//BACK
nCount--;
bNext = FALSE;
nResult = ListSetIndex( listConnections, nCount );
ListCurrentString( listConnections, szConnection );
endif;
else
if( bNext = TRUE ) then
//Move on to next connection
nCount++;
nResult = ListGetNextString(listConnections, szConnection);
else
//BACK
nCount--;
nResult = ListSetIndex( listConnections, nCount );
ListCurrentString( listConnections, szConnection );
endif;
endif;

endwhile;

Hope this helps.

adlibedoc
08-22-2005, 10:48 AM
Thanks...that helps.

Related to this, I am assuming the Browse button on SQLServerSelectLogin calls the SQLBrowse dialog.....how can I change the functionality of this dialog so that it does not attempt to find servers on all connections specified in the IDE.

hidenori
08-23-2005, 11:01 AM
At this time, we query the servers for all the database technologies specified in the IDE. I filed the work order #IOC-000036719 so that we can address this requirement in a future release.

Thank you for reporting this.

adlibedoc
08-23-2005, 03:18 PM
Is it possible to edit the pre-defined SQLBrowse code ??

Srinivasa
04-26-2007, 12:25 AM
I also need same requirment.
I created two sql connection, one for 'oracle' and another for 'microsoft sql'. According to the server type selection, I need to display only corresponding srevers in the browser list.

Is there any fix for this. I am using 'Installshield script' type project. Installshield Version is 12.

hidenori
04-26-2007, 01:31 PM
The work order #IOC-000036719 will be fixed in InstallShield 2008. Unfortunately, we currently have no plans on providing the fix for the existing products.

Regards.