Subject Re: [IBO] Creating DB in code
Author Paul Schmidt
Jason:

On 9 Feb 2001, at 8:35, Jason Wharton wrote:

To: <IBObjects@yahoogroups.com>
From: "Jason Wharton" <jwharton@...>
Date sent: Fri, 9 Feb 2001 08:35:15 -0700
Send reply to: IBObjects@yahoogroups.com
Subject: Re: [IBO] Creating DB in code

> Please see the Contact sample application for how to use the script
> and check for the existence of the database..

I will take a look at it, I think contact actually works on my
machine, but some of the samples don't agree with D2, so I haven't
used many of them.

Okay, one funny question on this, I see that the key is in:

TdmContact.cnContactBeforeConnect however in my case Protocol could
be other then cpLocal (most likely cpTcpIp(?)) I would guess in that
case you don't bother to check for a file exists, you just drive on.

> As for adding users, look at the IB_Session interface for some
> methods, Alteruser() and it will allow you to do that too. Only
> problem there is you need to use the SYSDBA account and so you will
> need to embed the password in the EXE somewhere.

I would probably check who they are logged on as, and if they are not
logged on as SYSDBA, then they get a login prompt, where they need to
type in the SYSDBA password. I don't want it embedded anywhere,
because then they need a new .exe if they ever change it.

Actually that is the trick with the script above, the CREATE DATABASE
statement doesn't count on the SYSDBA password being other then
masterkey, in my case it's different. This could of course be built
on the fly. I don't think right now you can change a username, but
that might change, in future versions. There would need to be logic
somewhere that would allow the username for SYSDBA to be stored
somewhere.

Oh well, I think that's it for now, have a good weekend.....

Paul


>
> >
> > Hi everyone
> >
> > Okay, slowly but surely I am getting to know the stuff I need for
> > this thing.
> >
> > I would like to, using IBO and Delphi2, do the following in code:
> >
> > Create a database and all the tables, generators, triggers, etc. I
> > would assume that IB_Script could be used here? However I would
> > like to do this, before the user is connected to any database.
> > Preferably I would like to try connecting to the database, and if it
> > doesn't exist create and populate it.
> >
> >
> > Next I would like to be able to add users to/delete users from the
> > database, I think this requires services.api, is that accessable
> > through Delphi, or do I need something else. What I am thinking
> > here, is that the program doesn't have it's own security, if you
> > exist on the database, you can use it, if you don't then you can't.
> > If the user is added from the program, then it does the proper GRANT
> > statements to allow the user to do stuff. I would rather that the
> > user not need to use any client utilities, like IBConsole.
> >
> > Anyone have any ideas on either of these items?
> >
> >
> > Paul Schmidt,
> > Tricat Technologies
> > Email: paul@...
> > Website: www.tricattechnologies.com
> >
> >
> >
> >
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-~> eGroups is now Yahoo! Groups Click here for
> more details http://click.egroups.com/1/11231/1/_/685810/_/981733371/
> ---------------------------------------------------------------------_
> ->
>
>
>
>


Paul Schmidt,
Tricat Technologies
Email: paul@...
Website: www.tricattechnologies.com