Jump to content
Damon

Firedac connection to paradox via odbc

Recommended Posts

I have followed this instruction:

https://blogs.embarcadero.com/firedac-odbc-for-paradox-and-dbase-tables/

But it does not work.  When trying to make the TFDTable active the error occurs:  [FireDAC][Phys][ODBC][Microsoft][ODBC Paradox Driver] Unexpected error from external database driver (11265)..

If it matters, I am writing a program to convert my old Delphi 5 BDE Paradox tables to MySQL as part of an application upgrade.

I know this is a Delphi FireDAC problem, because the ODBC that was created to connect to the Paradox files works just fine with Crystal Reports.  Anyone have any solutions?

Share this post


Link to post
Guest
Guest

You can do the "bridge" between BDE and FireDAC using FDLocalSQL

 

image.thumb.png.08fae19e9dffeee9507aee0d90cf48cb.png   image.thumb.png.cf89684cc84f7b490ec20c3b04857fd5.png

 

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 372
  ClientWidth = 771
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object DBGrid1: TDBGrid
    Left = 8
    Top = 16
    Width = 425
    Height = 249
    DataSource = DataSource1
    TabOrder = 0
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'Tahoma'
    TitleFont.Style = []
  end
  object Database1: TDatabase
    AliasName = 'BDEDatabases'
    Connected = True
    DatabaseName = 'MyBDEDB'
    LoginPrompt = False
    SessionName = 'Default'
    Left = 520
    Top = 24
  end
  object DataSource1: TDataSource
    DataSet = FDQuery1
    Left = 672
    Top = 304
  end
  object FDConnection1: TFDConnection
    Params.Strings = (
      'Database=:memory:'
      'DriverID=SQLite')
    Connected = True
    LoginPrompt = False
    Left = 672
    Top = 112
  end
  object FDLocalSQL1: TFDLocalSQL
    Connection = FDConnection1
    Active = True
    DataSets = <
      item
        DataSet = Table1
      end>
    Left = 672
    Top = 168
  end
  object FDQuery1: TFDQuery
    Active = True
    LocalSQL = FDLocalSQL1
    Connection = FDConnection1
    SQL.Strings = (
      'Select * from Table1')
    Left = 672
    Top = 232
  end
  object FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink
    Left = 520
    Top = 240
  end
  object FDGUIxWaitCursor1: TFDGUIxWaitCursor
    Provider = 'Forms'
    Left = 512
    Top = 184
  end
  object Table1: TTable
    Active = True
    DatabaseName = 'BDEDatabases'
    TableName = 'biolife.db'
    Left = 600
    Top = 24
  end
end

 

hug

Edited by Guest

Share this post


Link to post

Thank you but it really does not address the question.  The odbc works, just not in delphi, or not in firedac.  There must be an alternate way or fix for the connection.  The odbc connection works for Crystal reports, it works for excel... surely there is a way to make it work in delphi.  Installing the BDE is not an option.  You "bridge" suggestion says it requires SQLLite.

 

Share this post


Link to post
Guest
6 hours ago, Damon said:

Thank you but it really does not address the question.  The odbc works, just not in delphi, or not in firedac.  There must be an alternate way or fix for the connection.  The odbc connection works for Crystal reports, it works for excel... surely there is a way to make it work in delphi.  Installing the BDE is not an option.  You "bridge" suggestion says it requires SQLLite.

 

SQLite is native on FireDAC, and it works on ":memory:" -- none phisical database is necessary!

Share this post


Link to post
Guest

ok, now my new sample using "just" FireDAC components and ODBC driver:

image.thumb.png.b69d9dc20a8b1aeb9cdf04684fc3b6be.pngimage.thumb.png.e8acfdde0f4853d4f6ac6242fe10bf81.png    image.thumb.png.b726bcee9bd175331b697d27d3d702ef.png

CollatingSequence=International;DefaultDir=D:\RioSamples\Data;DriverId=538;FILEDSN=D:\RioSamples\Data\MyParadoxODBCdriver.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;ParadoxNetPath=C:\Windows\system32;ParadoxNetStyle=4.x;ParadoxUserName=admin;SafeTransactions=0;Threads=3;UserCommitSync=Yes
-------------------------------------------------------------------------------------------------

CollatingSequence=International;  // Grouping string/sequence
DefaultDir=D:\RioSamples\Data;  // directory default where is *.db (Paradox files)
DriverId=538;
FILEDSN=D:\RioSamples\Data\MyParadoxODBCdriver.dsn;  // created by "Wizard form FireDAC for easy return to project" - I saved it in my Paradox files directory for easy find it!
MaxBufferSize=2048;
MaxScanRows=8;
PageTimeout=5;
ParadoxNetPath=C:\Windows\system32;
ParadoxNetStyle=4.x;
ParadoxUserName=admin;
SafeTransactions=0;
Threads=3;
UserCommitSync=Yes

 

 

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 401
  ClientWidth = 833
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object DBGrid3: TDBGrid
    Left = 8
    Top = 8
    Width = 609
    Height = 361
    DataSource = DataSource1
    TabOrder = 0
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'Tahoma'
    TitleFont.Style = []
  end
  object FDConnection3: TFDConnection
    ConnectionName = 'myParadoxODBCconn'
    Params.Strings = (
      'ODBCDriver=Driver do Microsoft Paradox (*.db )'
      'User_Name=admin'
      
        'ODBCAdvanced=CollatingSequence=International;DefaultDir=D:\RioSa' +
        'mples\Data;DriverId=538;FILEDSN=D:\RioSamples\Data\MyParadoxODBC' +
        'driver.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;Parado' +
        'xNetPath=C:\Windows\system32;ParadoxNetStyle=4.x;ParadoxUserName' +
        '=admin;SafeTransactions=0;Threads=3;UserCommitSync=Yes'
      'DriverID=ODBC')
    Connected = True
    LoginPrompt = False
    Left = 688
    Top = 32
  end
  object FDTable2: TFDTable
    Active = True
    IndexFieldNames = 'Species No'
    Connection = FDConnection3
    UpdateOptions.UpdateTableName = 'biolife'
    TableName = 'biolife'
    Left = 688
    Top = 96
  end
  object DataSource1: TDataSource
    DataSet = FDTable2
    Left = 688
    Top = 168
  end
end

Im not using "PhysODBC" component because im using the unit reference in my unit/form code:

uses
  Winapi.Windows,
  Winapi.Messages,
  System.SysUtils,
  System.Variants,
  System.Classes,
  Vcl.Graphics,
  Vcl.Controls,
  Vcl.Forms,
  Vcl.Dialogs,
  Data.DB,
  FireDAC.Stan.Intf,
  FireDAC.Stan.Option,
  FireDAC.Stan.Error,
  FireDAC.UI.Intf,
  FireDAC.Phys.Intf,
  FireDAC.Stan.Def,
  FireDAC.Stan.Pool,
  FireDAC.Stan.Async,
  FireDAC.Phys,     {here}
  FireDAC.Phys.ODBC,    {here}
  FireDAC.Phys.ODBCDef,    {here}
  FireDAC.VCLUI.Wait,
  FireDAC.Stan.Param,
  FireDAC.DatS,
  FireDAC.DApt.Intf,
  FireDAC.DApt,
  FireDAC.Comp.DataSet,
  FireDAC.Comp.Client,
  Vcl.Grids,
  Vcl.DBGrids;

 

unit:

implementation

{$R *.dfm}

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  FDTable2.Close;
  FDConnection3.Close;
  //
  FDLocalSQL1.Active := false;
  FDQuery1.Close;
  FDConnection1.Close;
  //
  Table1.Close;
  Database1.Close;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  FDConnection3.Open();
  FDTable2.Open();
  //
  Database1.Connected := true;
  Table1.Open;
  //
  FDConnection1.Open();
  FDLocalSQL1.Active := true;
  FDQuery1.Open();
end;

initialization

// Session.NetFileDir := '<< your NET_DIR path to your BDE session>>';
Session.PrivateDir := GetCurrentDir;

finalization

end.

 

hug

Edited by Guest

Share this post


Link to post
On 12/21/2020 at 4:16 PM, Dmitry Arefiev said:

1) Please post FireDAC environment report for your connection:

http://docwiki.embarcadero.com/RADStudio/Sydney/en/DBMS_Environment_Reports_(FireDAC)#Using_the_TFDConnection_Design_Time_Editor

2) Can you attach one of the DB files ?

================================
Connection definition parameters
================================
Database=C:\Degei4\Data
ODBCDriver={Microsoft Paradox Driver (*.db )}
DataSource=degei4migration
DriverID=ODBC
================================
FireDAC info
================================
Tool = RAD Studio 10.4
FireDAC = 27.0.0 (Build 99682)
Platform = Windows 32 bit
Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR
================================
Client info
================================
Loading driver ODBC ...
  Loading odbc32.dll driver manager
  Creating ODBC environment handle
Driver Manager version = 03.81.19041.0000
================================
Session info
================================
Current catalog = 
Current schema = 
Driver name = odbcjt32.dll
Driver version = 10.00.19041
Driver conformance = 3
DBMS name = PARADOX
DBMS version = 05.00.0000

 

 

Master.DB

Master.MB

Master.PX

Master.VAL

Share this post


Link to post

@emailx45  where does the connectionname property come from on the firedac connection?  Is that the ODBC connection name?  I'm working through your example, thank you.

I notice that my app gives a different error at run time.  When connecting the firedac connection it gives data source name not found and no default driver specified, but AT design time it says it is connected fine???

Share this post


Link to post
Guest
object FDConnection3: TFDConnection
    ConnectionName = 'myParadoxODBCconn

 

 

on FDConnection component property

Share this post


Link to post

Still unsuccessful at this.  I have tried both versions of the microsoft driver that are on windows with no luck. 

Every time the connection establishes fine, the FDTable will read the odbc and find all of the tables in the folder.  Once I try to set the FDTable to active i get the error.  The driver will not read the data.   This is a FIREDAC config (my fault) or operational problem - as I can use the same ODBC that I created and it works just fine in Crystal reports as shown in the screen shots.

I am completely baffled.  Same error (11265) when trying to activate an FDQuery also.

Damon

 

 

Screenshot 2021-01-09 115316.jpg

Screenshot 2021-01-09 115226.jpg

Screenshot 2021-01-09 114654.jpg

Screenshot 2021-01-09 114537.jpg

Screenshot 2021-01-09 114009.jpg

Share this post


Link to post
Guest

see my screenshot above

I dont have DATABASE or DATASOURCE property use.

The definitions is on the ODBCADVANCED string, look above

Share this post


Link to post

I started from scratch with the FDconnection and finally got it to work i think.  Thanks for sticking with me.  There are some architecture errors when using FDTable, but not with FDQuery so i will just use that.  The FireDAC seems very picky with these old paradox tables.  But thanks again for all your help!  Now i can start writing the import to MySql.

 

1104641814_Screenshot2021-01-10130456.thumb.jpg.01ff7855f1e625582b74b245f46357fd.jpg

Share this post


Link to post
Guest

ok.

if possible click thanks buttons. help anothers see solutions when a answer is good for "askER"

 

Hug

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×