Firebird embedded, anonymous user, moved to another machine: cannot connect lazarus / 16-Databases ---------------------------------------------------------------------- Evadido · 2014-06-04 16:52 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 · 2014-06-04 18:50 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. ---------------------------------------------------------------------- Evadido · 2014-06-05 07:57 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 · 2014-06-05 08:02 Quote from: Evadido on June 05, 2014, 09:57:18 amIf 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_embedd ed_installation and the troubleshooting section below that. ---------------------------------------------------------------------- BigChimp · 2014-06-05 08:04 Quote from: Evadido on January 02, 1970, 03:56:35 pmI 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 ---------------------------------------------------------------------- Evadido · 2014-06-05 08:11 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 · 2014-06-05 08:22 Ehm, what about trying http://wiki.lazarus.freepascal.org/Firebird_embedded#Linux ---------------------------------------------------------------------- Evadido · 2014-06-05 08:27 That's exactly what I installed... ---------------------------------------------------------------------- BigChimp · 2014-06-05 08:58 Sorry, but you are very unclear. E.g. why did you not respond to this: Quote from: BigChimp on June 05, 2014, 10:02:31 amSo 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) ---------------------------------------------------------------------- Evadido · 2014-06-05 09:14 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 · 2014-06-05 10:07 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?