Firebird News

Sunday, November 11, 2012

Using Lazarus IDE with Firebird in Ubuntu and Debian

Install the ide
sudo apt-get install lazarus-ide
Start the ide from the console/terminal

 lazarus-ide &
If everything went well you'll see a new tab called SQLdb. This tab will contain two components a TSQLConnection and a TSQLQuery.








SQLdb tab also contains a component TIBConnection that you can place it on the form


We will connect to /var/lib/firebird/2.5/data/employee.fdb
On the form put an TIBConnection, TSQLTransaction,TSQLQuery,TDatasource and an TDBGrid









TIBConnection is configured to have DatabaseName=/var/lib/firebird/2.5/data/employee.fdb
Password=masterkey
Username=sysdba
and Transaction=SQLTransaction1
You can put it to be Connected = True




Then configure SQLTransaction1
to use

Database=IBConnection1
Active =True;




Configure TSQLQuery this way

Database:IBConnection1
SQL=select * from employee;
Active = True;








Configure TDatasource
DataSet=SQLQuery1



Configure TDBGrid

DataSource = DataSource1




Next you can put an button and make them active from run time


procedure TForm1.Button1Click(Sender: TObject);
begin
SQLQuery1.Active:=true;
end;









2 comments:

pabloj said...

That's very nice Marius.
You should put up a similar article about writing an UDF for Firebird with it, I find the writings available on the web to be "not really for dummies" :-)
Regards

mariuz said...

Thanks for the idea , i will try to create an udf with freepascal