Database error Missing Driver Name Property

Asked

Viewed 1,059 times

0

I am making a system in Delphi 2010 with Firebird 2.5 that I select a database and I need to pass path location to my Database in 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 don’t know how to do it right.

2 answers

3

Fabrício, instead of loading each connection property, 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
  • Rodrigo. Is working by gluing the direct bank path. If I put 'DataBase=localhost: + txtArquivo.Text' does not work. If I put 'DataBase=localhost:C:\Projetos\Delphi\CentralRit\db\BDLIVRO.FDB' works.

0

SQLCon.Close;
  SQLCon.Params.Values['Database']:='localhost:'+txtArquivo.Text;
SQLCon.Open;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.