Lazarus

Programming => Databases => Topic started by: incendio on January 23, 2019, 08:30:30 am

Title: [SOLVED] Firebird Connection problem
Post by: incendio on January 23, 2019, 08:30:30 am
Hi guys,

I tried to connect to remote Firebird database using TSQLConnetor.

On Object Inspector, I fill these value :

When tried to changed Connected value to True via Object Inspector, got the error :
TIBConnection : DoInternalConnect : - connection shutdown

But when run the app and tried to open database and query via these codes :
Code: Pascal  [Select][+][-]
  1. procedure TMainFrm.FormCreate(Sender: TObject);
  2. begin
  3.   ConnDb.Open;
  4.   QBrcd1.Close;
  5.   QBrcd1.Open;
  6. end;
  7.  

It was run OK.

Why can't set TSQLConnector to Active via Object Inspector? What's the problem here?

Title: Re: Firebird Connection problem
Post by: BSaidus on January 24, 2019, 01:28:42 pm
did you copy fbclient.dll to your system directory or the fbclient.dll is located on the same directory as your application.

Hi guys,

I tried to connect to remote Firebird database using TSQLConnetor.

On Object Inspector, I fill these value :
  • ConnecorType = Firebird
  • DatabaseName = My_db
  • HostName= server_ip
  • Password= ****
  • username= user
  • LoginPrompt= False

When tried to changed Connected value to True via Object Inspector, got the error :
TIBConnection : DoInternalConnect : - connection shutdown

But when run the app and tried to open database and query via these codes :
Code: Pascal  [Select][+][-]
  1. procedure TMainFrm.FormCreate(Sender: TObject);
  2. begin
  3.   ConnDb.Open;
  4.   QBrcd1.Close;
  5.   QBrcd1.Open;
  6. end;
  7.  

It was run OK.

Why can't set TSQLConnector to Active via Object Inspector? What's the problem here?
Title: Re: Firebird Connection problem
Post by: incendio on January 25, 2019, 05:59:48 am
Yes, I did.
Title: Re: Firebird Connection problem
Post by: BSaidus on January 25, 2019, 09:33:33 am
Then Put fbclient.dll on the same directory as your lazarus.exe
if your lazarus is located in C:\lazarus
 then put fbclient in C:\lazarus\fbclient.dll

It must work.
Title: Re: Firebird Connection problem
Post by: incendio on January 25, 2019, 11:23:53 am
I put fbclient.dll in these folder :

1) Window\system32
2) Windows\systemWow64
3) same folder with lazarus.exe
4) same folder with the app

None worked. I also tried not to fill password & username, the error message is the same.

Btw, I using Lazarus 1.8.4 32bit on Windows 64 with Firebird 3.0.4 64, could it be the caused of the problem?

Title: Re: Firebird Connection problem
Post by: rvk on January 25, 2019, 11:38:19 am
I put fbclient.dll in these folder :

1) Window\system32
2) Windows\systemWow64
3) same folder with lazarus.exe
4) same folder with the app

None worked. Btw, I using Lazarus 1.8.4 32bit on Windows 64, could it be the caused of the problem?
Yikes, don't (EVER) put the same fbclient.dll in system32 and SysWOW64.
The system32 is for 64bit versions and the SysWOW64 is for 32bit versions. Don't mix them.

Remove all manually added versions and install the client in the correct way.
Chances are the wrong version is used now for lazarus.exe.

After removing any trace and reinstalling the client-version properly, it should be available for both your app.exe and lazarus.exe.

B.T.W. the client doesn't install fbclient in system32 and SysWOW64 anymore, it adds a registry entry in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs

Title: Re: Firebird Connection problem
Post by: incendio on January 25, 2019, 11:50:07 am
What do you mean by install Firebird Client? I always use Firebird*.exe to setup on Windows and on installation process just click NEXT, everything leaves as default except for password for sysdba.

What I don't understand is why connection via code works without a problem?
Title: Re: Firebird Connection problem
Post by: rvk on January 25, 2019, 12:35:39 pm
You said you connected to a remote server.
You installed the Firebird*.exe into the client?
(default serverinstallation will install the client too so that should be ok)

What version of Firebird is installed on the remote and what version did you install on the client?
Title: Re: Firebird Connection problem
Post by: incendio on January 25, 2019, 12:43:49 pm
On a remote : Firebird 3.0.3
On client : Firebird 3.0.4

Connect locally gave the same error.
Title: Re: Firebird Connection problem
Post by: rvk on January 25, 2019, 01:10:59 pm
Firebird 3 will install fbclient.dll automatically to system32 and SysWOW64 (the correct one in each directory, NOT the same).

So, if you have no fbclient.dll in your app directory, it should take the correct one from SysWOW64. Lazarus 1.8.2 33 bit should do the same (if there is no fbclient.dll in the lazarus.exe directory).

And I think it does locate the fbclient.dll and uses it, otherwise you would get an exception saying it can't find/use fbclient. So I'm puzzled as why it doesn't work.

You did use the complete path+databasename in databasename?

Does the TIBConnection give the same problems?

(O, and try disabling your firewall temporarily on the client)
Title: Re: Firebird Connection problem
Post by: incendio on January 25, 2019, 01:59:08 pm
I tried with complete database path & database alias, none worked.

The point is, connection by code works fine.
If there is something wrong with fbclient or firewall, connection by code won't work.

Could it be the bug in Lazarus?

Has someone here able to set connection to Firebird via object inspector?
Title: Re: Firebird Connection problem
Post by: rvk on January 25, 2019, 02:21:31 pm
Has someone here able to set connection to Firebird via object inspector?
Yes, I've just tried that in a VM with Windows 7 and Lazarus 1.8.2 32 bit.
Connecting to a remote server running Firebird 3.0 worked fine in the IDE with TIBConnection and TSQLConnector.
Title: Re: Firebird Connection problem
Post by: incendio on January 25, 2019, 03:01:35 pm
TIBConnection?

I don't use this. I thought since activated TSqlConnection via code works, this component is not needed.

I will try to add that component when I get around on my computer and see the result.
Title: Re: Firebird Connection problem
Post by: incendio on January 26, 2019, 03:06:32 am
Today, I turn on computer, start Lazarus and create a new project.

Add TSQLConnector, set its properties, and set Connected properties via Object Inspector and it worked!

But, as I wrote this post, I tried again to set Connected properties on and off, and the error came back!

Close again Lazarus, start new project & do the same, set Connected to True and it work again! Tried On/Off a couple time, still worked.

Very strange, I don't know why it works, still a mystery.
My environment :

I will mark this post as SOLVED for now, will open again if problem reappeared again.

Thanks to all that have been help me.

Btw, for connection to database, I only use TSQLConnector, never use TIBConnection.
Title: Re: Firebird Connection problem
Post by: incendio on January 27, 2019, 06:12:03 am
Hi, sorry guys, have to reopen again the problem.

Problem still exist !

Sometimes, set Connected property via Object Inspector works, sometimes, not work, it is very random.

Whenever, Connection raised an error, restart Lazarus and start again could give a success.

Where is the wrong? Is it from Lazarus or from Windows ?
Title: Re: Firebird Connection problem
Post by: rvk on January 27, 2019, 10:25:40 pm
Only thing I can think of is a virusscanner which holds the connection too long and a subsequent chevron is refused. What virisscanner (if any) are you using?

Did you try disabling or uninstalling it ?
Title: Re: Firebird Connection problem
Post by: incendio on January 28, 2019, 07:34:26 am
That's make sense.

I am using Comodo Firewall 5.12.252301.

I remembered allow Comodo to let Lazarus made IP Connection.
After allowed, should be no restriction again.

I will check again for a few more days, caused this error happen randomly.

Right now , with Firewall ON, TSQLConnector runs OK. Will turn Firewall Off if error happen again and see the result.
Title: Re: Firebird Connection problem
Post by: incendio on February 05, 2019, 05:41:49 am
After a few tests, I rarely faced the problem again.
And if it occurred again, restarted Lazarus solved the problem.

It was a mystery why the problem occurred, but since the solution found, I will close this thread as SOLVED.

Thanks to everyone that has helped me.
Title: Re: [SOLVED] Firebird Connection problem
Post by: cybervoigt on June 27, 2019, 03:10:53 pm
Hello folks,
I´m having this error message
"DoInternalConnect:
-connection shutdown"

My Lazarus project (Lazarus 2.0.2) has a button to test the database (Firebird 2.5.6) connection, and the error ocurs in the SECOND click on that button...

It started with none changes in my software, but the computer has "windows 10"... (there is this june´s windows updates: KB4023057, KB4503286, KB4503308  :( )

And on Windows 7, the same exe file don´t show the error message...

The fbclient.dll is on the same project´s path.

I did a test, running the prior version of my project compiled in Lazarus 2.0.0 and ocurs the same error message.

Regards,
Ricardo
Title: Re: [SOLVED] Firebird Connection problem
Post by: CE on August 25, 2019, 09:11:06 pm
Has anyone a solution? I found out, that this error appears if the last connection in a project is closed. It seams, that the driver is unloaded.
TinyPortal © 2005-2018