Board index » delphi » 'nother newbie question concerning building databases from within an app

'nother newbie question concerning building databases from within an app

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.

 

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.

Re:'nother newbie question concerning building databases from within an app


<sigh>, This keeps happening and I may have to turn in my shingle and become
a rancher. Yet another case of failing to RTFM. It's right there in the Help
file if one is clever enough to read it (which I wasn't).
Thanx for your prompt response and for pointing me in the right direction.

I am, however, still waiting for a use for IB aliases - anyone wish to
enlighten me?

--FDWeller

Re:'nother newbie question concerning building databases from within an app


Quote
In article <3b83141f$1_1@dnews>, spamth...@juno.com wrote...

Hi,

Quote
> I am, however, still waiting for a use for IB aliases

None.  They are an IBConsole thing, and will only work with IBConsole.  
There is a use for 'real' server side aliases (so you can move the
database files around without updating your clients connection string),
but this will need to be built into the engine.  Maybe a future version
of FB/IB will implement this.

Dave

Re:'nother newbie question concerning building databases from within an app


Quote
Dave{*word*106}inson wrote:

> None.  They are an IBConsole thing, and will only work with IBConsole.
> There is a use for 'real' server side aliases (so you can move the
> database files around without updating your clients connection string),
> but this will need to be built into the engine.  Maybe a future version
> of FB/IB will implement this.

        This was discussed at the Borland convention this summer as a feature
for a future version of IB, so I'd say it's likely.  In the meantime,
there are third-party tools for this if you need it today.  Ask on the
borland.public.interbase.thirdparty group if you'd like specific
recommendations.

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:'nother newbie question concerning building databases from within an app


Thought so - thanx, folks, for the prompt responses.

--FDWeller

"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> wrote in message
news:3B83C3C8.141997B0@no_spam.vertexsoftware.com...

Quote

> Dave{*word*106}inson wrote:

> > None.  They are an IBConsole thing, and will only work with IBConsole.
> > There is a use for 'real' server side aliases (so you can move the
> > database files around without updating your clients connection string),
> > but this will need to be built into the engine.  Maybe a future version
> > of FB/IB will implement this.

> This was discussed at the Borland convention this summer as a feature
> for a future version of IB, so I'd say it's likely.  In the meantime,
> there are third-party tools for this if you need it today.  Ask on the
> borland.public.interbase.thirdparty group if you'd like specific
> recommendations.

> -Craig

> --
>  Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
> We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
>      Delphi/InterBase WebLog: http://delphi.weblogs.com

Other Threads