Recent

Author Topic: disconnect from a DB  (Read 3831 times)

Ati

  • New Member
  • *
  • Posts: 41
disconnect from a DB
« on: August 19, 2006, 09:42:24 am »
Hello together,

how can i really disconnect from a Firebird-DB. I used db.connected:=false but it seems that is this not right.

Ati

  • New Member
  • *
  • Posts: 41
disconnect from a DB
« Reply #1 on: August 21, 2006, 09:44:09 am »
Hello again,

i want to give you more informations about the kind of problem i have.
I have a login-form, where the user must give his user name (e.g. KLU) and his password. After Button-klick my app login as SYSDBA and get the ROLE. Then it should make a disconnect and connect again with usernam+pass+role. At the first it seem´s to be okay. But as i proof it with IBExpert i saw that the user logged in as SYSDBA?? So i think there is something wrong with my code. Here is my Code:
Code: [Select]
procedure TForm2.Button1Click(Sender: TObject);
var user,rolle,pass:String;
begin
  user:=upcase(eduser.Text);
  pass:=edpass.Text;
  dm.qrlog.SQL.Text:='SELECT RDB$RELATION_NAME from RDB$USER_PRIVILEGES where (rdb$user_privileges.RDB$USER = '''+user+''') and (rdb$user_privileges.rdb$object_type=13)' ;
  dm.qrlog.open;
  label3.Caption:=dm.qrlog.FieldByName('RDB$RELATION_NAME').AsString;
  rolle:=dm.qrlog.FieldByName('RDB$RELATION_NAME').AsString;
  dm.dbmainlog.Connected:=false;
  dm.dbmainlog.Close;
  dm.dbmainlog.Open;
  dm.dbmainlog.UserName:=user;
  dm.dbmainlog.Password:=pass;
  dm.dbmainlog.Role:=rolle;
  dm.dbmainlog.Connected:=true;
  showmessage('Eingeloggt als '+user);
  Form1.ShowModal;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
  dm.dbmainlog.UserName:='SYSDBA';
  dm.dbmainlog.Password:='masterkey';
  dm.dbmainlog.Connected:=true;
end;  

Ati

  • New Member
  • *
  • Posts: 41
disconnect from a DB
« Reply #2 on: August 21, 2006, 11:48:30 am »
I have found an another way. I use for the login seperate db-components. After i get the ROLE i give the parameters to the main-components (all on a DataModul). But now i have the phenomenon that my program tell´s me that the table "test1" is unknown???

 

TinyPortal © 2005-2018