Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB Tools

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2014, 04:45 AM
jr_ozv jr_ozv is offline
Junior Member
 
Join Date: Mar 2012
Posts: 18
Default how connect mysql database in host

hi
i want connect to mysql database in host
i install mydac component in delphi but closed 3306 port

Friends had suggested use php web service for connect database

How it should be done?

have example?

tnx
Reply With Quote
  #2  
Old 06-24-2014, 08:41 AM
kolbasz kolbasz is offline
Senior Member
 
Join Date: Nov 2013
Posts: 841
Default

Did you install a mysql server to your computer or do you want to connect to a remote computer? Please be more specific!
Reply With Quote
  #3  
Old 06-24-2014, 09:05 AM
jr_ozv jr_ozv is offline
Junior Member
 
Join Date: Mar 2012
Posts: 18
Default

i want connect to remote compure
Reply With Quote
  #4  
Old 06-24-2014, 09:26 AM
kolbasz kolbasz is offline
Senior Member
 
Join Date: Nov 2013
Posts: 841
Default

Quote:
i want connect to remote compure
Then make sure:
1. Remote access is enabled on the mysql server
2. A firewall/AV doesn't block your connection

Remote access is usually disabled for security reasons, so probably the best solution is to use a php webservice to communicate with the mysql service. You can send Get and Post commands from delphi with TIdHttp(just google it), and read the response.
Reply With Quote
  #5  
Old 06-25-2014, 04:27 AM
jr_ozv jr_ozv is offline
Junior Member
 
Join Date: Mar 2012
Posts: 18
Default

have you example ?

if have , plaease uploud.

tnx
Reply With Quote
  #6  
Old 06-25-2014, 04:46 AM
kolbasz kolbasz is offline
Senior Member
 
Join Date: Nov 2013
Posts: 841
Default

Quote:
have you example ?
if have , plaease uploud.
tnx
Tested with Delphi XE2 and PHP 5.4.25. This will add two numbers, but you can do more complex operation, like read data from table, send receive images, etc...

1. Delphi

Drop a TidHTTP component and a TButton to your form. Doubleclick the button:
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
  url: string;
  SS: TStringStream;
  SL: TStringList;
begin
  url := 'http://localhost/Delphi.php'; //<--change this to your URL
  SL := TStringList.Create;
  try
    SL.Add('a=' + IntToStr(4));
    SL.Add('b=' + IntToStr(5));
    SS := TStringStream.Create('');
    try
      IdHTTP1.Post(URL, SL, SS);
      ShowMessage(ss.DataString);
    finally
      SS.Free;
    end;
  finally
    SL.Free
  end;
end;
2. PHP(save this to delphi.php, and upload to your server)
Code:
<?php
  $a=$_POST['a'];
  $b=$_POST['b'];
  echo $a + $b;
?>
Reply With Quote
  #7  
Old 06-25-2014, 07:58 AM
jr_ozv jr_ozv is offline
Junior Member
 
Join Date: Mar 2012
Posts: 18
Default

thank you my dear friend
very gooood
Reply With Quote
  #8  
Old 11-08-2016, 02:44 AM
Rantor777 Rantor777 is offline
Junior Member
 
Join Date: Nov 2016
Location: 127.0.0.1
Posts: 10
Default HTTP Tunnel.

HTTP Tunneling is the Answer... Sorry. Late Reply.

Regards!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:29 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.