tobenschain 0 Posted July 6, 2022 I do not understand why I am getting [FireDAC][Stan][Def]-254. Definition [C:\Prog2\employee.fdb] is not found in [C:\WINDOWS\FDConnectionDefs.ini] This is C:\WINDOWS\FDConnectionDefs.ini [EMPLOYEE] DriverID=FB Protocol=TCPIP Database=C:\Prog2\employee.fdb User_Name=sysdba Password=masterkey CharacterSet= ExtendedMetadata=True I am using XE7. This is my code var out_Table: TFDTable; out_Connection: TFDConnection; begin out_Table := TFDTable.Create(Application); with out_Table, FieldDefs do begin Clear; Add('key',ftString, 51); Add('data',ftString, 32{000}); Add('control',ftString, 32{000}); TableName := out_Table.Name; Convert := TConvert.Create(Application); Connection := Convert.FDConnection1; Active := true; end; Share this post Link to post
Brian Evans 105 Posted July 6, 2022 The file has a definition of EMPLOYEE not C:\Prog2\employee.fdb. What is the definition/settings for Convert.FDConnection1? Share this post Link to post
Lajos Juhász 293 Posted July 6, 2022 In this code snippet you don't have how you set up the connection and that's the error you got. My guess is that in your code somewhere the connection's ConnectionDefName property is set to C:\Prog2\employee.fdb instead of EMPLOYEE. Share this post Link to post
tobenschain 0 Posted July 6, 2022 Now I get '[FireDAC][Phys][FB]I/O error during "CreateFile (open)" operation for file ":C:\Prog2\employee.fdb" Error while trying to open file The filename, directory name, or volume label syntax is incorrect. I set ConnectionDefName. I posted the wrong .pas code. It is now type TForm2 = class(TForm) DBNavigator1: TDBNavigator; DataSource1: TDataSource; Cprog2employeefdbConnection: TFDConnection; FDTable1: TFDTable; procedure FormCreate(Sender: TObject); end; procedure TForm2.FormCreate(Sender: TObject); begin with FDTable1, FieldDefs do begin Clear; Add('key',ftString, 10); Add('data',ftString, 32{000}); Add('control',ftString, 32{000}); end; Cprog2employeefdbConnection.Connected := true; end; Share this post Link to post
tobenschain 0 Posted July 6, 2022 unit2.dfm: object Form2: TForm2 Left = 0 Top = 0 Caption = 'Form2' ClientHeight = 411 ClientWidth = 710 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 DBNavigator1: TDBNavigator Left = 68 Top = 39 Width = 240 Height = 25 TabOrder = 0 end object DBGrid1: TDBGrid Left = 18 Top = 83 Width = 675 Height = 311 DataSource = DataSource1 TabOrder = 1 TitleFont.Charset = DEFAULT_CHARSET TitleFont.Color = clWindowText TitleFont.Height = -11 TitleFont.Name = 'Tahoma' TitleFont.Style = [] end object DataSource1: TDataSource DataSet = FDTable1 Left = 345 Top = 36 end object Cprog2employeefdbConnection: TFDConnection Params.Strings = ( 'ConnectionDef=EMPLOYEE') LoginPrompt = False Left = 103 Top = 159 end object FDTable1: TFDTable Connection = Cprog2employeefdbConnection Left = 244 Top = 163 end end Share this post Link to post
Brian Evans 105 Posted July 6, 2022 The error message shows a colon at the start of the path\file. ":C:\Prog2\employee.fdb" Your code shows signs of leftovers from trying different things. Make a NEW project and get a connection working with as little as possible. Once done clean up the old code to match. Share this post Link to post
tobenschain 0 Posted July 6, 2022 I need to somehow reinstall the FireBird Data Explorer Share this post Link to post
Hans J. Ellingsgaard 21 Posted July 6, 2022 When you use the tcp/ip connection, you must define the server. If you are running you DB on same computer as program, you can use the 127.0.0.1 ip address. Share this post Link to post
weirdo12 19 Posted July 21, 2022 On 7/6/2022 at 11:53 AM, tobenschain said: I need to somehow reinstall the FireBird Data Explorer Why are you using Firebird? Share this post Link to post
weirdo12 19 Posted July 21, 2022 40 minutes ago, weirdo12 said: Why are you using Firebird? I see this is an old question 😉 Anyway, I should have asked: Is there a particular reason you are using Firebird? Share this post Link to post
weirdo12 19 Posted July 24, 2022 On 7/20/2022 at 10:13 PM, tobenschain said: i got it to work and it's free Did you consider just using SQLite? Share this post Link to post
tobenschain 0 Posted January 25, 2023 i can create a sqlite file in memory but I cannot save it to disk Share this post Link to post
programmerdelphi2k 237 Posted January 25, 2023 (edited) in fact, you can do the "backup" as any other file-DB! type TForm1 = class(TForm) FDConnection1: TFDConnection; FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink; FDGUIxWaitCursor1: TFDGUIxWaitCursor; Button1: TButton; DBGrid1: TDBGrid; DataSource1: TDataSource; FDQuery1: TFDQuery; Button2: TButton; FDSQLiteBackup1: TFDSQLiteBackup; DBGrid2: TDBGrid; FDConnection2: TFDConnection; FDQuery2: TFDQuery; DataSource2: TDataSource; Button3: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin FDConnection1.Params.Database := ':memory:'; FDConnection1.ExecSQL('create table mytable(id integer, names varchar(20));'); FDConnection1.ExecSQL('insert into mytable values(1, ''john'');'); FDConnection1.ExecSQL('insert into mytable values(2, ''mary'');'); FDConnection1.ExecSQL('insert into mytable values(3, ''peter'');'); FDQuery1.Open('select * from mytable'); end; procedure TForm1.Button2Click(Sender: TObject); begin FDSQLiteBackup1.DriverLink := FDPhysSQLiteDriverLink1; FDSQLiteBackup1.DatabaseObj := FDConnection1.CliObj; // <-- your DB opened on FDConnnect1 -> :memory: in case! FDSQLiteBackup1.DestDatabase := 'mySQLiteTarget.db'; // <-- file to save on disk or you can target to another ":memory:" FDSQLiteBackup1.Backup; end; procedure TForm1.Button3Click(Sender: TObject); begin FDConnection2.Close; FDConnection2.Params.Database := 'mySQLiteTarget.db'; FDConnection2.DriverName := 'SQLite'; FDQuery2.Open('select * from mytable'); end; end. ... object FDConnection1: TFDConnection Params.Strings = ( 'DriverID=SQLite') end object FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink end object FDGUIxWaitCursor1: TFDGUIxWaitCursor Provider = 'Forms' end object DataSource1: TDataSource DataSet = FDQuery1 end object FDQuery1: TFDQuery Connection = FDConnection1 end object FDSQLiteBackup1: TFDSQLiteBackup Catalog = 'MAIN' DestCatalog = 'MAIN' end object FDConnection2: TFDConnection end object FDQuery2: TFDQuery Connection = FDConnection2 end object DataSource2: TDataSource DataSet = FDQuery2 end end Edited January 25, 2023 by programmerdelphi2k Share this post Link to post
programmerdelphi2k 237 Posted January 25, 2023 (edited) about Firebird usage, not problem at all! you can choice between 3 connnection type: this is not about database usage, just "about the connection type used by FireDAC" PERSISTENT: with-name, using FDConnectionDefs.ini (done in Design-Time) PRIVATE: with-name, not stored on FDConnectionDefs.ini (done in Design-Time) TEMPORARY: without-name, and done on code! https://docwiki.embarcadero.com/RADStudio/Sydney/en/Defining_Connection_(FireDAC) just inform the right params to find the "FDB" file, as well as the library (FBClient.DLL) path! Else, the FireDAC will try find in default system folders you can have a "FDConnectionsDef.ini" in your exe folder! not needs use the Embarcadero default! Edited January 25, 2023 by programmerdelphi2k Share this post Link to post