Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:36:43+00:00 2026-05-13T15:36:43+00:00

I’d like to compile a setup that will connect to a remote database using

  • 0

I’d like to compile a setup that will connect to a remote database using the credentials provided by the user, then install few db components using .sql script.

Is that possible using Inno Setup?

More details:

I’d like to have a custom form, asking the user to enter the database address and credentials, then run a command that will execute an sql script that will update the remote database server.

If the update is successful – complete the installation with success.

This is rather general question – I have a lot of customized setups that should connect to different servers/run different scripts – the idea is to build a generic form that will provide this functionality.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:36:44+00:00Added an answer on May 13, 2026 at 3:36 pm

    I don’t think you can have a completely generic form, as for different servers you may need either a single connection string, or a server name and an (optional) port; for some servers you will use system authentication, for others a user name password tuple.

    Having said that I will give you a small demo Inno script that asks for server name and port, user name and password, then makes a few tests, then executes an application that is extracted (by code) to the temp directory and will be deleted by the installer. You can use this as a starting point for your scripts. Having a few of such snippets, and including them in your scripts as necessary will probably be all you need:

    [Setup]
    AppID=DBUpdateTest
    AppName=Test
    AppVerName=Test 0.1
    AppPublisher=My Company, Inc.
    DefaultDirName={pf}\Test
    DefaultGroupName=Test
    DisableDirPage=yes
    DisableProgramGroupPage=yes
    OutputBaseFilename=setup
    PrivilegesRequired=none
    
    [Files]
    Source: "isql.exe"; DestDir: "{tmp}"; Flags: dontcopy
    Source: "update_V42.sql"; DestDir: "{tmp}"; Flags: dontcopy
    
    [Languages]
    Name: "english"; MessagesFile: "compiler:Default.isl"
    
    [Code]
    var
      DBPage: TInputQueryWizardPage;
    
    procedure InitializeWizard;
    begin
      DBPage := CreateInputQueryPage(wpReady,
        'Database Connection Information', 'Which database is to be updated?',
        'Please specify the server and the connection credentials, then click Next.');
      DBPage.Add('Server:', False);
      DBPage.Add('Port:', False);
      DBPage.Add('User name:', False);
      DBPage.Add('Password:', True);
    
      DBPage.Values[0] := GetPreviousData('Server', '');
      DBPage.Values[1] := GetPreviousData('Port', '');
      DBPage.Values[2] := GetPreviousData('UserName', '');
      DBPage.Values[3] := GetPreviousData('Password', '');
    end;
    
    procedure RegisterPreviousData(PreviousDataKey: Integer);
    begin
      SetPreviousData(PreviousDataKey, 'Server', DBPage.Values[0]);
      SetPreviousData(PreviousDataKey, 'Port', DBPage.Values[1]);
      SetPreviousData(PreviousDataKey, 'UserName', DBPage.Values[2]);
      SetPreviousData(PreviousDataKey, 'Password', DBPage.Values[3]);
    end;
    
    function NextButtonClick(CurPageID: Integer): Boolean;
    var
      ResultCode: Integer;
    begin
      Result := True;
      if CurPageID = DBPage.ID then begin
        if DBPage.Values[0] = '' then begin
          MsgBox('You must enter the server name or address.', mbError, MB_OK);
          Result := False;
        end else if DBPage.Values[2] = '' then begin
          MsgBox('You must enter the user name.', mbError, MB_OK);
          Result := False;
        end else if DBPage.Values[3] = '' then begin
          MsgBox('You must enter the user password.', mbError, MB_OK);
          Result := False;
        end else begin
          ExtractTemporaryFile('isql.exe');
          ExtractTemporaryFile('update_V42.sql');
          if Exec(ExpandConstant('{tmp}') + '\isql.exe', '--user ' + DBPage.Values[2]
            + ' --password ' + DBPage.Values[3] + ' --database ' + DBPage.Values[0]
            + ':foo --script update_V42.sql', '',
            SW_HIDE, ewWaitUntilTerminated, ResultCode)
          then begin
            // check ResultCode and set Result accordingly
            Result := ResultCode = 0;
          end else begin
            MsgBox('Database update failed:'#10#10 + SysErrorMessage(ResultCode),
              mbError, MB_OK);
            Result := False;
          end;
        end;
      end;
    end;
    

    Beware: I haven’t fully tested this, so there may be more code necessary to properly clean everything up. Error handling is definitely missing!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 351k
  • Answers 351k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Do note that COUNT(id) will usually result in a full… May 14, 2026 at 7:16 am
  • Editorial Team
    Editorial Team added an answer You probably know this or suspect it, but there's no… May 14, 2026 at 7:16 am
  • Editorial Team
    Editorial Team added an answer No. That's impossible. May 14, 2026 at 7:16 am

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.