Re:'nother newbie question concerning building databases from within an app
Hi,
I'm also very new to interbase, doing the same as you, converting from
paradox...
You first have to decide how you want to connnect. In D6, you can use BDE,
Interbase Express Components or dbExpress. We've decided to go the
dbExpress route, with a couple of Interbase Express components for good
measure.
You can use an IBDatabase component to create your database (can someone let
me know if there's an easier way to do this!), and then we use standard
queries to create tables, triggers, etc.
Here's a snippet of our create database area - we had lots of fun working
out the parameters here. Note this is very raw, no excpetion handling as
yet.
// Create database
if currentDatabaseEngine = databaseNumInterbase then
begin
// Set username and password, database name
IBDatabase.params.clear;
IBDatabase.params.add('user ''' + currentDatabaseLoginName + '''');
IBDatabase.params.add('password ''' + currentDatabasePassword + '''');
IBDatabase.databaseName := currentFullInterbaseName;
IBDatabase.createDatabase;
end
The variable currentFullInterbaseName might be: 'c:\mydatabase
\groovydata.gdb' or it could be 'ntserver:c:\mydatabase\remotedatabase.gdb'.
The createDatabase method works for local and remote connections.
Following this (which is only the first time the app. is run), we connect
using dbExpress, and then use TSQLQuery to create tables etc. We have all
our table metadata in text files, we read in the statements, and zap them
off. We'll change the text files to dlls further down the track.
Regards,
Peter Lee
"FDWeller" <spamth...@juno.com> wrote in news:3b82d986_2@dnews:
Quote
> The usual disclaimer goes here: "I am a complete newbie with regard to
> InterBase", however, I'm *not* a newbie where Delphi is concerned.
> My environment is Delphi 6 Ent, InterBase 6 (the Borland version).
> So, my questions are these:
> 1. How does one create the initial link to the server so that one
> might create a new database via Delphi? I am building a standalone
> application which will rely on InterBase as it's back-end. I want to be
> able to hand the user two CDs - the media kit (they get their own
> licenses) and my application ROM. On my ROM I would like to put a
> program in the start-up sequence which will, after InterBase has been
> installed iaw the media kit instructions and the server has been
> started, execute a series of scripts which will create my database,
> create the tables, etc in the database and show the user progress as
> these items are taking place. In short, a "boot-strap" program which
> executes the script meta data for the database. Once I have a
> connection, I am presuming that I can send DDL via any SQL Query
> component (using the IBX components, DBXpress, etc) to create the
> tables, indexes, triggers, stored procs, etc., however, it's getting
> that first link between my application and the server in order to
> create the database itself that I can't figure out. Suggestions?
> Components to use? Sequence of events? I don't care if it's third
> party, so long as the source is available so I can see what is going
> on. I am hoping that I won't have to go to the API to get this done (as
> in I hope someone else has already Been There, Done That and done the
> hard part) but if I need to, you can be assured that a component will
> soon follow that does what I need it to once I figure out how to make
> the API go.
> 2. Sort of a general question - just what good are aliases in
> InterBase? I can't see where they can be used to resolve a connection
> (ala the BDE) and the only component that I have seen so far that does
> perform such resolution is Java based and with WebServices and whatnot
> now available, I would expect that a SOAP implementation of such a
> component has already been implemented but I haven't seen one. But
> beyond that single use, I can't see a single obvious use other than
> giving the database a name so that IBConsole can tell the difference
> between databases.