Jump to content

Alex Joseph

Members
  • Content Count

    5
  • Joined

  • Last visited

Everything posted by Alex Joseph

  1. Alex Joseph

    Fetch server IP in android client app

    I have firedac datasnap server connected to mssql database server. I am using dbx connection from my firemonkey client app that is running on android mobile. Since I have different datasnap servers using the same App, how is it possible to acquire the IP address of the datasnap server with a parameter from client side. Can someone help me on this issue.
  2. Alex Joseph

    Fetch server IP in android client app

    hi, I tried , but was not solving the problem. I made a small unit to save the IP Address in a txt file and on datamodulebefore create event load the ip from txt file. Thank you very much for helping me. procedure TFrmParam.BtnLoadClick(Sender: TObject); var TextFile : TStringList; FileName : string; begin try textFile := TStringList.Create; try FileName := Format('%sIPFile.txt',[GetHomePath]); if FileExists(FileName) then begin textFile.LoadFromFile(FileName); Memo1.Lines :=textfile; end else begin showMessage('File not exists, Create New File'); TextFile.Text := '0.0.0.0'; TextFile.SaveToFile(FileName); end; finally textFile.Free; end; except on E : Exception do ShowMessage('ClassError: '+e.ClassName+#13#13+'Message: '+e.Message); end; end; procedure TFrmParam.BtnSaveClick(Sender: TObject); var TextFileS : TStringList; FileName : string; begin try textFileS := TStringList.Create; try if memo1.Text <> '' then begin FileName := Format('%sIPFile.txt',[GetHomePath]); TextFileS.Text := Memo1.Text; TextFileS.SaveToFile(FileName); end; finally textFileS.Free; end; except on E : Exception do ShowMessage('ClassError: '+e.ClassName+#13#13+'Message: '+e.Message); end; end; procedure TDataModuleFDClient.DataModuleCreate(Sender: TObject); var Lmemstream : Tmemorystream; server : Tobject; TextFile : TStringList; FileName : string; serverip : string; begin serverip :='0.0.0.0'; textFile := TStringList.Create; try FileName := Format('%sIPFile.txt',[GetHomePath]); if FileExists(FileName) then begin textFile.LoadFromFile(FileName); serverip :=textfile.Strings[0]; end; finally textFile.Free; end; SQLConnection1.Connected :=false; sqlconnection1.params.values['HostName'] :=serverip; SQLConnection1.Connected :=true; end;
  3. Alex Joseph

    Fetch server IP in android client app

    DS Server Unit is correct. My Datasnap server is running on windows 2012 server. Server IP is 192.168.103.57 My client App is on Zebra Android Mobile device. Please see the files attached. Hope this will help you. AndClient.rar DSServer.rar
  4. Alex Joseph

    Fetch server IP in android client app

    Hi, This is working fine. But It is giving the Android device IP. I think I have to save the IP address of DatasnapServer in a file SERVERIP.INI in the device itself. From client side I should be able to read the IP address from SERVERIP.INI file and pass it to a string variable Vserverip SqlConnection1Beforeconnect(Sender: Tobject); begin sqlconnection1.params.values['HostName'] :=Vserverip; end Read /Write INI files from android client side should solve my problem. Sorry for poor english.
  5. Alex Joseph

    Fetch server IP in android client app

    Hope this attached image will help you to understand my connection params. Our servers are all stand alone. Thank you
×