Recent

Author Topic: Firebird embedded, anonymous user, moved to another machine: cannot connect  (Read 6609 times)

Evadido

  • New Member
  • *
  • Posts: 17
Hi,

I'm developing a database based app on ubuntu (14.04). Im using anonymous database user:

  ibconnection1.hostname:='';
  IBConnection1.DatabaseName:= ExtractFilePath(Application.EXEName)+'olakase.fdb';
  IBConnection1.CharSet:= 'UTF8';

It works fine, but if a move the application to another machine, it cannot connect to the database, it throws the following error:

"DoInternalConnect :
 -cannot attach to password database."

I tried with SYSDBA/masterkey, but the error changes to: "IBConnection1 : DoInternalConnect :
 -cannot attach to password database."

What is supposed the username/password to be?

Thank you!!!  :)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Why are you asking for the username/password? The error message says the firebird server cannot attach to the password database, meaning it cannot find it.
Try running isql/fb-isql from that directory and see if you can connect that way. If not, you've set up your server incorrectly.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Evadido

  • New Member
  • *
  • Posts: 17
Thank you very much for your answer,

If I create (from code) the database on this machine, the program can connect flawlessly, but it cannot connect to the same database created on another machine, without user and password. I think that, when you create an anonymous database, it is created with default values (the system user maybe?), and it fails to open on another system. Am I wrong?

Thank you very much

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
If I create (from code) the database on this machine, the program can connect flawlessly, but it cannot connect to the same database created on another machine, without user and password.
So you are specifying the host name/ip address in the TIBConnection's HostName property?
Then you will need a user name and password, which has been set up by your db admin. Anonymous access is not possible.
System-level user for Firebird is SYSDBA. Default password is masterkey but some systems/package managers (e.g. Debian) change that on installation for security reasons. See your distribution's documentaiton.

Further troubleshooting steps:
http://wiki.lazarus.freepascal.org/firebird#Client.2Fserver_and_embedded_installation
and the troubleshooting section below that.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
I think that, when you create an anonymous database, it is created with default values (the system user maybe?), and it fails to open on another system. Am I wrong?
No, you're wrong...
Users and passwords are defined in security2.fdb/the security database for that database server. The users in one db server can be different from those in another.
See Firebird documentation, e.g. http://firebirdfaq.org/
http://firebirdsql.org
« Last Edit: June 05, 2014, 10:21:39 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Evadido

  • New Member
  • *
  • Posts: 17
Aaaaah, I understand. How can I then create a really portable app which will not interfere with another possible applications which use firebird?

I thought that using embedded fb, it would be totally independent.

Thank you for your explanations

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Evadido

  • New Member
  • *
  • Posts: 17
That's exactly what I installed...  :(

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Sorry, but you are very unclear.

E.g. why did you not respond to this:
So you are specifying the host name/ip address in the TIBConnection's HostName property?

I suspect you're specifying username and password contrary to the instructions.
You could copy and paste your code in a post (please use the code tags, see the button marked # in the post editor toolbar)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Evadido

  • New Member
  • *
  • Posts: 17
That's the creating/opening code. I don't provide any user/password info.

Code: [Select]
  ldelete:=false;
  if fileexists(olakase.fdb') then
      begin
      if (messagedlg('Delete previous data?',mtInformation,[mbOk,mbCancel],0)=mrok)  then
         ldelete:=true;
         end
      else
         ldelete:=true;


  if ldelete then DeleteFile('olakase.fdb');


  ibconnection1.hostname:='';
  IBConnection1.DatabaseName:= ExtractFilePath(Application.EXEName)+'olakase.fdb';
  IBConnection1.CharSet:= 'UTF8';
  ibconnection1.Close;

  if ldelete then
     begin
          IBConnection1.CreateDB;
          sqltransaction1.StartTransaction;
          ibconnection1.ExecuteDirect('CREATE TABLE blinks (recno integer, url varchar(500), pr varchar(2), anchor varchar(200), lang varchar(5), S varchar(1));');
          sqltransaction1.Commit;
          sqltransaction1.EndTransaction;
     end;


  sqlquery1.FieldDefs.Add('recno',ftinteger);
  sqlquery1.FieldDefs.Add('url',ftstring);
  sqlquery1.FieldDefs.Add('pr',ftstring);
  sqlquery1.FieldDefs.add('anchor',ftstring);
  sqlquery1.FieldDefs.add('lang',ftstring);
  sqlquery1.fielddefs.add('S',ftstring);
  sqlquery1.sql.text:='select * from blinks;';
  sqlquery1.open;

Thank you very much

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Ok that looks good. So either you're not following the other instructions (which files to put where) or the instructions themselves do not work correctly on your system.
What does ls -al in your project directory show?

1. In your project directory, could you run
Code: [Select]
ls -al lib/libfbembed.so
ls -al firebird.conf
ls -al security.fdb
ls -al intl/fbintl
ls -al udf/fbudf.so
cat firebird.conf
and paste the output?

2. What script/start program are you using to set the environment variables LD_LIBRARY_PATH, FIREBIRD and start your program?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018