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

Ludo Brands ludo.brands at free.fr
Sat Mar 9 15:07:26 CET 2013


On 03/09/2013 02:08 PM, 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?
> 
Have you tried the fbadmin unit that comes with 2.6.2? It implements
some of the interbase service routines such as user management and
backup/restore. There has a convenient AddUser method.

Ludo



More information about the fpc-pascal mailing list