Subject Re: [IBO] how to create database from script
Author Jason Wharton
I think there might be a problem in TIB_Script with how I handle the SET
NAMES line of script code. I need to look into this. Try it without and let
me know how it goes.

The suggestion to use CreateDatabase would probably be a good idea. Just be
sure to have the associated TIB_Connection connected prior to running the
rest of the script.

Ideally, I want you to be able to just run the script and have the database
created on the fly.

Jason

----- Original Message -----
From: "Queck Rainer" <Rainer.Queck@...>
To: "IBObjects (E-Mail)" <IBObjects@yahoogroups.com>
Sent: Monday, September 29, 2003 6:28 AM
Subject: [IBO] how to create database from script


> Hi List,
>
> I have a scrip that workes fine from within IB_Expert.
> There I can execute this script and create my database.
>
> How can I achieve the same result with "TIB_Script" using the same script
file?
>
> I tried :
>
> GenDbScr.SQL.LoadFromFile(FSqlScript);
> GenDbScr.Sql.SaveToFile('C:\temp\spc.sql');
> GenDbScr.Execute;
>
> but here I get "Statement must have an IB_Connection assigned.
> Well I assigned my IB_Connection but then I get the
> "invalid database handle (no active connection)" message.
>
> Well then I set the DbConnection.Connected:=True and recieved the "can't
finde file"message which is true, since I in this moment have no
database....
>
> What is the right way to create a database with a given script?
>
> Thanks for hints
> Rainer
>
> //snip form script....
> //=============
>
>
/***************************************************************************
***/
> /**** SPC Database
****/
>
/***************************************************************************
***/
>
> SET SQL DIALECT 3;
>
> SET NAMES ISO8859_1;
>
> CREATE DATABASE '<MyServer>:<Desired paht and db name>'
> USER '<MyUser>' PASSWORD '<my password>'
> PAGE_SIZE 8192
> DEFAULT CHARACTER SET ISO8859_1
> FILE '<Desired file1>' LENGTH 244000 PAGES
> FILE '<Desired file2>' LENGTH 244000 PAGES
> .................
> FILE '<Desired file n>' LENGTH 244000 PAGES ;
>
> /* ====================== DOMAINS
============================================*/
> CREATE DOMAIN D_STREAM AS BLOB SUB_TYPE 0 SEGMENT SIZE 80;
>
> ...... and so on.
> As mentioned the script works fine from within IB-Expert.