Delphi cannot find any database driver

132 Views Asked by At

I'm just trying to connect to database but there's exception:

Project Project.exe raised exception class TDBXError with message 'Unknown driver: Microsoft dBase Driver (*.dbf)'.

uses
  Data.DB, Data.SqlExpr, Vcl.Dialogs;
var
  SQLConnection1: TSQLConnection;
  SQLQuery1: TSQLQuery;
begin
  SQLConnection1 := TSQLConnection.Create(nil);
  SQLQuery1 := TSQLQuery.Create(nil);
  try
    SQLConnection1.ConnectionName := 'dBase'; // it's my DSN, I called it like this
    SQLConnection1.DriverName := 'Microsoft dBase Driver (.*dbf)'; //and I also tried a lots of drivers
    SQLConnection1.LibraryName := 'C:\Windows\SysWOW64\odbcjt32.dll';
    SQLConnection1.Params.Add('Database=C:\DB');
 //here was my username and password
    SQLConnection1.Open;
    SQLQuery1.SQLConnection := SQLConnection1;
    SQLQuery1.SQL.Text := 'SELECT 2-2'; // just nothing
    SQLQuery1.Open;

    while not SQLQuery1.Eof do
    begin

      SQLQuery1.Next;
    end;
  finally
    SQLQuery1.Free;
    SQLConnection1.Close;
    SQLConnection1.Free;
  end;
  readln;
end.

My DSN's

I made sure that I'm using 32 bit application, and in the C:\DB files exist. I also tried to create system DSN and input to SQLConnection1.ConnectionName, but it does not help. Why can't my delhi project see any driver?

0

There are 0 best solutions below