Firebird 2.0, ZEOS DBO, create new database at runtime lazarus / 16-Databases ---------------------------------------------------------------------- seekbirdy · 2007-03-06 10:53 Hi all, I wanted to create a new FB2.0 database at runtime, so it is rather known that to do this we should do smth like that: Code: [Select]   with ZConnection2 do begin     Protocol:='firebird-2.0';     Database:='D:\1.fdb';     Properties.Clear;     Properties.Add('CreateNewDatabase = CREATE DATABASE ' + QuotedStr(Database) +          ' USER ' + QuotedStr('SYSDBA') + ' PASSWORD ' + QuotedStr('masterkey') +          ' DEFAULT CHARACTER SET WIN1251');     Connect;   end But the execution of this code fails on the assignment Code: [Select]Database:='D:\1.fdb': Could not find the file specified. Obviously, the file 1.fdb doesn't exist,because I just wanna create it.   Does anybody know what is the reason of this error? ---------------------------------------------------------------------- jozagulikoza · 2007-03-11 15:12 > I wanted to create a new FB2.0 database at runtime, so it is rather known that to do this we should do smth like that: This is not good idea. CREATE DATABASE WITH DB TOOL NOT WITH CLIENT PROGRAM ! You have wrong concept in your project. ---------------------------------------------------------------------- Zomis · 2007-03-18 17:01 I think jozagulikoza should give a pretty good argument for creating DBs with an additional tool instead of a "client program", DB tools are also client programs. Unfortunately, seekbirdy, I haven't used Firebird. But maybe you should look for a "file must exist" property, or look for another component... don't you have other Firebird-related components than ZConnection2? And what kind of component is your ZConnection2? ---------------------------------------------------------------------- Delphino · 2013-06-01 17:33 procedure TForm29.FormCreate(Sender: TObject); begin  with con1 do  begin     Protocol:='firebird-2.1';     ClientCodepage := 'ISO8859_1';     TransactIsolationLevel := tiReadCommitted;     LibraryLocation := 'fbclient.dll';     Database:='C:\Databases\test.fdb';     Properties.Clear;     Properties.Values['dialect'] := '3';     Properties.Values['CreateNewDatabase'] :=       'CREATE DATABASE ' + QuotedStr(Database) +       ' USER ' + QuotedStr('SYSDBA') + ' PASSWORD ' + QuotedStr('masterkey') +       ' PAGE_SIZE 4096 DEFAULT CHARACTER SET ISO8859_1';     User := 'SYSDBA';     Password := 'masterkey';     Connect;   end;   with qry1, SQL do   begin     Clear;     Add('RECREATE TABLE test (');     Add('  id INTEGER NOT NULL PRIMARY KEY,');     Add('  descrip VARCHAR(20) NOT NULL');     Add(')');     ExecSQL;   end;   con1.Reconnect;   qry2.SQL.Text := 'SELECT * FROM TEST';   qry2.Open;   qry2.Close;   con1.Disconnect; end; ---------------------------------------------------------------------- k1attila1 · 2013-06-03 11:11 look at TurboBird source code it is written with lazarus and sqldb http://code-sd.com/products/turbobird/ it can create database at runtime