2
I’m starting to program with the Delphi XE8 and using Firebird 2.5.
I managed to implement my database and it’s working all right.
The problem I’m facing now is that as I change from computers to programming (home, college, etc), I have to change the path where my database file is located, compile and only then can I run the program.
I want to change my configuration TSQL Connection at runtime and not having to compile the program every time I switch from computer.
In case, create a Form with the program settings or, before the program initializes, request the database path.
In the image is highlighted the property I want to modify.
I tried with this code:
procedure TDMDados.ConexaoBeforeConnect(Sender: TObject);
begin
Conexao.Params:= 'Caminho do arquivo';
end;
The problem is that, as I have already configured this connection, this parameter is already defined.
Some parameters of the connection:
DriverName=Firebird
DriverUnit=Data.DBXFirebird
DriverPackageLoader=TDBXDynalinkDriverLoader,DbxCommonDriver220.bpl
DriverAssemblyLoader=Borland.Data.TDBXDynalinkDriverLoader,Borland.Data.DbxCommonDriver,Version=22.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
MetaDataPackageLoader=TDBXFirebirdMetaDataCommandFactory,DbxFirebirdDriver220.bpl
MetaDataAssemblyLoader=Borland.Data.TDBXFirebirdMetaDataCommandFactory,Borland.Data.DbxFirebirdDriver,Version=22.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
LibraryName=dbxfb.dll
LibraryNameOsx=libsqlfb.dylib
VendorLib=fbclient.dll
VendorLibWin64=fbclient.dll
VendorLibOsx=/Library/Frameworks/Firebird.framework/Firebird
Database=C:\Users\Johnny\Dropbox\1.MESTRADO\10.DISSERTAÇÃO\PROGRAMA DELPHI\Banco de dados\bd.fdb
User_Name=sysdba
Password=masterkey
Role=RoleName
[...]
My intention is to change this connection parameter at runtime:
Database=C:\Users\Johnny\Dropbox\1.MESTRADO\10.DISSERTAÇÃO\PROGRAMA DELPHI\Banco de dados\bd.fdb
"- I still haven’t been able to try this because I don’t know how to start. I know to change the connection parameters before compiling".
Then, the program runs smoothly. I would like to change the connection configuration of my DB at runtime. I do not know if there is a way to modify the parameters of the connection before it is executed. I still haven’t been able to try this because I don’t know how to start. I know how to change the connection parameters before compiling....
– Johnny Arza
I made some changes to the question and put the parameters of my connection. I did not find in the bibliographies that I read a native function of Delphi that modifies this parameter. As I can modify the Database parameter (as photo) directly by Object Inspector, I thought I had a command of the style " Connected.properties.Database ='path'. However I did not succeed in these cases.
– Johnny Arza
Thanks for the help
– Johnny Arza
Ready. I did what I could. Soon someone answers...
– LipESprY
Thanks. It looks much better =D Now I have a little more base on how to format the questions around here
– Johnny Arza
Then read the articles from help center which will already be a basis for understanding the overall functioning of the community. ;)
– LipESprY