I need to (in a program) create a firebird database (either locally or on a server) and then run an sql-script to generate the table-structure.
I could do that by running the fireird tool "isql" with
Code: Select all
isql -u SYSDBA -p masterkey -q -i GenerateEmptyDb.sql
(The GenerateEmptyDb-script holds a CREATE DATABASE statement)
isql EmptyDB.fdb -u SYSDBA -p masterkey -q -i MyDDEScript.sql
First I tried to execute the scripts directly using TIBCScript as described here http://forums.devart.com/viewtopic.php?f=28&t=24169 and here http://forums.devart.com/viewtopic.php?f=31&t=24052
So I tried this
Code: Select all
IBCConnection1.Username:='sysdba';
IBCConnection1.Password:='masterkey';
IBCConnection1.LoginPrompt:=False;
IBCConnection1.Server:='localhost';
IBCScript1.Connection:=IBCConnection1;
IBCScript1.NoPreconnect:=True;
IBCScript1.SQL.Text:='CREATE DATABASE ''C:\test.fdb'' PAGE_SIZE 16384 DEFAULT CHARACTER SET UTF8;';
IBCScript1.Execute;
Hmmm... ok, I tried something other.
In the forum I found this entry: http://forums.devart.com/viewtopic.php?f=31&t=24052
CreateDatabase - sounds promising.
In the help I read "Call the CreateDatabase method to create an InterBase database using Params as the rest of the CREATE DATABASE statement." so I tried
Code: Select all
IBCConnection1.Params.Text:='E:\EmptyDb.fdb PAGE_SIZE 16384 DEFAULT CHARACTER SET UTF8';
IBCConnection1.CreateDatabase;
Now I don't know any futher. Please help!