Why can't I change hte SQLConnetor to point to another database lazarus / 63-Database ---------------------------------------------------------------------- WimVan · 2018-12-20 21:28 I want using an application to access several databases.  Why can't I do that ? I use win10, Lazarus 1.8.4 TSQLconnector, dataabse Mysql 5.7 and have the correct libmysql.Dll Here is the code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   MasterQuery.Close;  MasterQuery.Close;  MasterSQLTransaction.Active := False;  DBConnection.Connected      := False;  DBConnection.close(true);  DBConnection.DatabaseName   := 'pmoisr';  DBConnection.HostName       := 'Localhost';  DBConnection.UserName     := 'root';  DBConnection.Connected      := True;  DBConnection.Open;  MasterSQLTransaction.Active := True;  MasterQuery.Active          := True;  There is no compile or build-error Application pops up and closed directly. What's wrong ? ---------------------------------------------------------------------- valdir.marcos · 2019-02-22 22:02 Quote from: WimVan on December 20, 2018, 10:28:00 pmI want using an application to access several databases.  Why can't I do that ? I use win10, Lazarus 1.8.4 TSQLconnector, dataabse Mysql 5.7 and have the correct libmysql.Dll Here is the code Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   MasterQuery.Close;  MasterQuery.Close;  MasterSQLTransaction.Active := False;  DBConnection.Connected      := False;  DBConnection.close(true);  DBConnection.DatabaseName   := 'pmoisr';  DBConnection.HostName       := 'Localhost';  DBConnection.UserName     := 'root';  DBConnection.Connected      := True;  DBConnection.Open;  MasterSQLTransaction.Active := True;  MasterQuery.Active          := True;  There is no compile or build-error Application pops up and closed directly. What's wrong ?I have attached a very small example which works for Firebird, try to adapt it for your MySQL case. Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CREATE TABLE Table1(  Field1 INTEGER NOT NULL PRIMARY KEY,  Field2 VARCHAR(50) NOT NULL);Commit; INSERT INTO Table1(Field1, Field2) VALUES(1, 'aaa');INSERT INTO Table1(Field1, Field2) VALUES(2, 'bbb');INSERT INTO Table1(Field1, Field2) VALUES(3, 'ccc');INSERT INTO Table1(Field1, Field2) VALUES(4, 'ddd');INSERT INTO Table1(Field1, Field2) VALUES(5, 'eee');Commit; SELECT * FROM Table1; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, IBConnection, sqldb, db, FileUtil, Forms, Controls,  Graphics, Dialogs; type   { TForm1 }   TForm1 = class(TForm)    DataSource1: TDataSource;    IBConnection1: TIBConnection;    SQLQuery1: TSQLQuery;    SQLTransaction1: TSQLTransaction;    procedure FormCreate(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin  IBConnection1.Connected := False;  IBConnection1.HostName := 'localhost/3050';  IBConnection1.DatabaseName := 'C:\teste\FirebirdMultiDatabaseExample\SampleData1.fdb';  IBConnection1.UserName := 'SYSDBA';  IBConnection1.Password := 'masterkey';  IBConnection1.CharSet := 'UTF8';  IBConnection1.Connected := True;   SQLQuery1.Close;  SQLQuery1.SQL.Text := 'Select Field2 From Table1 Where Field1 = 1;';  SQLQuery1.Open;  ShowMessage(SQLQuery1.FieldByName('Field2').AsString);  SQLQuery1.Close;  SQLTransaction1.Commit;  IBConnection1.Connected := False;   IBConnection1.Connected := False;  IBConnection1.DatabaseName := 'C:\teste\FirebirdMultiDatabaseExample\SampleData2.fdb';  IBConnection1.Connected := True;   SQLQuery1.Open;  ShowMessage(SQLQuery1.FieldByName('Field2').AsString);  SQLQuery1.Close;  SQLTransaction1.Commit;  IBConnection1.Connected := False;   IBConnection1.Connected := False;  IBConnection1.DatabaseName := 'C:\teste\FirebirdMultiDatabaseExample\SampleData3.fdb';  IBConnection1.Connected := True;   SQLQuery1.Open;  ShowMessage(SQLQuery1.FieldByName('Field2').AsString);  SQLQuery1.Close;  SQLTransaction1.Commit;  IBConnection1.Connected := False;end; end. ---------------------------------------------------------------------- Zvoni · 2019-02-23 06:17 If it's TSQLConnector, don't you have to specify the connection-type? ---------------------------------------------------------------------- valdir.marcos · 2019-02-23 06:26 Quote from: Zvoni on February 23, 2019, 07:17:36 amIf it's TSQLConnector, don't you have to specify the connection-type?Yes, you have to, but you don't always need to use TSQLConnector for a multi database approach, as I just showed.