[fpc-pascal] Connecting to Firebird using FPC/Lazarus over a LAN with user creation privilege

Tony Whyman tony.whyman at mccallumwhyman.com
Sat Mar 9 15:03:41 CET 2013


Mark,

You should be able to do this using the Firebird Services API. IBX
exposes this API under the Firebird Admin tab and the TIBSecurityService
class is what you are looking for.

This has methods to

"DisplayUsers", which gets info on all users and puts it into an array
property.

Adduser, ModifyUser and DeleteUser - which should be self-evident.

The original Borland documentation is not great but if you search on
TIBSecurityService you should get most questions answered and its worth
reading the Firebird Services API documentation to understand what is
going on.

Regards

Tony Whyman
MWA Software

On 09/03/13 13:08, Mark Morgan Lloyd wrote:
> I don't know whether anybody can help me with this one, but I'm
> working on something where I need a program to be able to create
> login-capable database users on-the-fly. I was hoping to be able to
> use either PostgreSQL or Firebird as the backend, but while Postgres
> is working fine Firebird is proving to be sufficiently difficult that
> I might just drop it.
>
> Using isql-fb on Debian x86, I've created a database borg_ng with,
> among others, a user borg_um to which I've granted admin and rdb$admin
> rights. If I use isql-fb running either as root or as firebird with
> the rdb$admin role I can create a new user and verify it using gsec:
>
> # isql-fb -user borg_um -password password -role 'rdb$admin'
> Use CONNECT or CREATE DATABASE to specify a database
> SQL> connect borg_ng;
> Database:  borg_ng, User: borg_um, Role: RDB$ADMIN
> SQL> create user test__4 password 'password';
> ..
> GSEC> di
>      user name                    uid   gid admin     full name
> ..
> TEST__4                             0     0
>
> Unfortunately I'm having a lot of difficulty doing this under program
> control, with the obvious difference being that FPC/Lazarus is
> connecting via a socket.
>
> Has anybody had anything like this working in the past?
>




More information about the fpc-pascal mailing list