Database error Missing Driver Name property

0

I'm doing a system in Delphi 2010 with Firebird 2.5 that I select a database and I need to pass the local path to my Database on my Sqlconnection.

procedure TFormImportDados.btnBuscaArquivoClick(Sender: TObject);
begin
  OpenDialog.Execute();
  txtArquivo.Text := OpenDialog.FileName;

  with SQLCon do
  begin
    close;
    ConnectionName  := 'localhost:' + txtArquivo.Text;
    DriverName      := 'Firebird';
    LibraryName     := 'dbxfb.dll';
    GetDriverFunc   := 'getSQLDriverINTERBASE';
    VendorLib       := 'fbclient.dll';
  end;
end;

procedure TFormImportDados.FormShow(Sender: TObject);
begin
 SimpleDataSet.Close;
 SimpleDataSet.Open;
end;

I'm not sure how to do this correctly.

    
asked by anonymous 04.07.2016 / 16:36

2 answers

3

Fabrício, instead of loading each property of the connection, you could load all the parameters at the same time.

SQLCon.Params.LoadFromFile('conexao.ini');

Here is an example of a file with the settings to be imported:

SchemaOverride=%.dbo
DriverUnit=Data.DBXMSSQL
DriverPackageLoader=TDBXDynalinkDriverLoader,DBXCommonDriver220.bpl
DriverAssemblyLoader=Borland.Data.TDBXDynalinkDriverLoader,Borland.Data.DbxCommonDriver,Version=22.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
MetaDataPackageLoader=TDBXMsSqlMetaDataCommandFactory,DbxMSSQLDriver220.bpl
MetaDataAssemblyLoader=Borland.Data.TDBXMsSqlMetaDataCommandFactory,Borland.Data.DbxMSSQLDriver,Version=22.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
GetDriverFunc=getSQLDriverMSSQL
LibraryName=dbxmss.dll
VendorLib=sqlncli10.dll
VendorLibWin64=sqlncli10.dll
HostName=<Nome do Host>
DataBase=<Banco de dados>
MaxBlobSize=-1
LocaleCode=0000
IsolationLevel=ReadCommitted
OSAuthentication=False
PrepareSQL=False
User_Name=<Usuário>
Password=<Senha>
BlobSize=-1
ErrorResourceFile=
OS Authentication=False
Prepare SQL=False
MARS_Connection=True
    
05.07.2016 / 18:26
0
SQLCon.Close;
  SQLCon.Params.Values['Database']:='localhost:'+txtArquivo.Text;
SQLCon.Open;
    
05.07.2016 / 20:48