Topic: How To Connnect MySQL Another Server And Cross Query ?
How To Connnect MySQL Another Server And Cross Query ?
In same time
Easy For Beginner Student For Me
My Visual Database → General → How To Connnect MySQL Another Server And Cross Query ?
How To Connnect MySQL Another Server And Cross Query ?
In same time
Hello prahousefamily
If you want to run multiple MySQL servers, the simplest way is to compile the servers with different TCP / IP ports and socket files so they do not all listen to the same port or the same socket.
For more explanations, you could go to this link : (sorry, it's in french), but informations are very interesting
http://cipcnet.insa-lyon.fr/sqltut/nexe … rvers.html
Regards
JB
An example, how to populate grid from another MySQL server
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
MySQL: TMyConnection;
begin
MySQL := TMyConnection.Create(Form1);
MySQL.Options.UseUnicode := True;
MySQL.Server := '10.10.10.10'; // ip address of MySQL server
MySQL.Port := 3306;
MySQL.Username := 'username';
MySQL.Password := 'password';
MySQL.Database := 'databasename';
MySQL.LoginPromt := False;
try
MySQL.Connect;
except
ShowMessage('Can''t connect to database.');
end;
if MySQL.Connected then
begin
Form1.TableGrid2.dbMySQLConnection := MySQL;
Form1.TableGrid2.dbSQL:='SELECT id, lastname, firstname FROM employees'; // the id field, want to be able to edit or delete the entry from the table component
Form1.TableGrid2.dbGeneralTable := 'employees';
Form1.TableGrid2.dbListFieldsNames :='delete_col,Фамилия,Имя';
Form1.TableGrid2.dbSQLExecute;
MySQL.Disconnect;
end;
end;
Thank You Dmitry.And jean.brezhonek
Now Can use script query Two server .....
Thank you Again
OPEN Code
procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);
var
MySQL2: TMyConnection;
begin
MySQL2 := TMyConnection.Create(Form1);
MySQL2.Options.UseUnicode := True;
MySQL2.Server := Form1.Edit6.Text ;
MySQL2.Port := strtoint(Form1.Edit9.Text);
MySQL2.Username := Form1.Edit7.Text;
MySQL2.Password := Form1.Edit8.Text;
MySQL2.Database := Form1.Edit10.Text;
MySQL2.LoginPromt := False;
try
MySQL2.Connect;
except
ShowMessage('Can''t connect to database.');
end;
if MySQL2.Connected then
begin
Form1.TableGrid2.dbMySQLConnection := MySQL2;
Form1.TableGrid2.dbSQL:='Show tables';
Form1.TableGrid2.dbSQLExecute;
MySQL2.Disconnect;
end;
end;
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
MySQL1: TMyConnection;
begin
MySQL1 := TMyConnection.Create(Form1);
MySQL1.Options.UseUnicode := True;
MySQL1.Server := Form1.Edit1.Text ;
MySQL1.Port := strtoint(Form1.Edit4.Text);
MySQL1.Username := Form1.Edit2.Text;
MySQL1.Password := Form1.Edit3.Text;
MySQL1.Database := Form1.Edit5.Text;
MySQL1.LoginPromt := False;
try
MySQL1.Connect;
except
ShowMessage('Can''t connect to database.');
end;
if MySQL1.Connected then
begin
Form1.TableGrid1.dbMySQLConnection := MySQL1;
Form1.TableGrid1.dbSQL:='Show tables';
Form1.TableGrid1.dbSQLExecute;
MySQL1.Disconnect;
end;
end;
begin
end.
My Visual Database → General → How To Connnect MySQL Another Server And Cross Query ?
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi