Database Connectivity for Sql server and oracle.

Comments

1 comment

  • Avatar
    wojciechka

    InstallBuilder does not provide built-in actions for connecting to databases.

    What you can do is run an external program to check the connectivity. For example:

    <validationActionList> <runProgram> <program>osql</program> <programArguments>-U "${username}" -P "${password}" -S "${instance}" -i "EXIT(SELECT 0)"</programArguments> <workingDirectory>${installdir}/osql</workingDirectory> </runProgram> <throwError> <text>Unable to connect to database</text> <ruleList> <compareValues> <logic>does_not_equal</logic> <value1>${program_exit_code}</value1> <value2>0</value2> </compareValues> </ruleList> </throwError> </validationActionList>

    This will validate if specified username, password and instance is correct.

    If you need to perform the check before installation, it is possible to unpack an entire directory for the test - for example:

    <validationActionList> <deleteFile> <path>${system_temp_directory}/osql_test</path> </deleteFile> <unpackDirectory> <component>osql</component> <destination>${system_temp_directory}/osql_test</destination> <folder>osql</folder> <origin>osql</origin> </unpackDirectory> <runProgram> <program>osql</program> <programArguments>-U "${username}" -P "${password}" -S "${instance}" -i "EXIT(SELECT 0)"</programArguments> <workingDirectory>${system_temp_directory}/osql_test</workingDirectory> </runProgram> <deleteFile> <path>${system_temp_directory}/osql_test</path> </deleteFile> <throwError> <text>Unable to connect to database</text> <ruleList> <compareValues> <logic>does_not_equal</logic> <value1>${program_exit_code}</value1> <value2>0</value2> </compareValues> </ruleList> </throwError> </validationActionList>

    It is documented in more details in Unpacking Before Installation Time section of InstallBuilder User Guide.

Please sign in to leave a comment.