Forum > Databases

Lazarus Firebird remote connection problems

(1/4) > >>

Ferke:
Hi,

I'm using Lazarus 1.6 (32 and 64 bits) with Firebird 3.0 32 bit. Lazarus is set to compile to 32 bit.
My problem is that I cannot make my program to connect to FB database remotely. If I run my program on the server everything works fine.
I have checked everything, I can connect to the database using the isql tool.

Please correct me I set something wrong.
Parameters of TIBConnection:
DatabaseName: C:\DB\DB.FDB <-- Here goes the path to DB file on the host (DB server) computer.
Host: 192.168.1.1 <-- IP address or name of the server. I tried to leave it blank and extended the DatabaseName like 192.168.1.1:C:\DB\DB.FDB

I copied the DLLs into the folder of the program. I don't know if that is necessary.
Additional question: Do I need to share the folder of the DB file on the network? I did earlier, and the DatabaseName was the path to the file from the client computer, but when I used isql tool I realized that I needed the path on the host.

Server runs in Classic mode.

Thank you very much in advance.

BR,
Ferenc

rvk:
First of all, can you connect to the servers database with the isql tool ON THE CLIENT?

If you can, then everything should work.
Otherwise:

*) 192.168.1.1 is usually a router. Are you sure that is a real server on that IP? (check with ipconfig /all on that machine).
*) Did you add a exception rule for firebird.exe in the firewall (or disabled the firewall and possible anti-virus completely).
*) Did you install the firebirdclient on the client.
*) Open a cmd prompt on the server and type netstat -an | findstr 3050
    Is a process listening on TCP 0.0.0.0:3050 ? Otherwise you need to make sure firebird is listening on its network ip.

DLLs in the program directory shouldn't be necessary (they also weren't on the server when you tested, I assume)

Ferke:
First of all, thanks for your answer, very appreciated. :)

First of all, can you connect to the servers database with the isql tool ON THE CLIENT? Yes.

) 192.168.1.1 is usually a router. Are you sure that is a real server on that IP? (check with ipconfig /all on that machine). This IP is fake in my example. In fact that is home server with fix IP.
*) Did you add a exception rule for firebird.exe in the firewall (or disabled the firewall and possible anti-virus completely). Ports are open and I could connect withthe ISQL tool.
*) Did you install the firebirdclient on the client. No. That is missing. I thought the DLL-s should be enough.
*) Open a cmd prompt on the server and type netstat -an | findstr 3050
    Is a process listening on TCP 0.0.0.0:3050 ? Otherwise you need to make sure firebird is listening on its network ip. Yes, this was the first thing I checked earlier.

DLLs in the program directory shouldn't be necessary (they also weren't on the server when you tested, I assume). Okay.

Thanks, I will make a test with the client nstallation.

 :)

Ferke:
The client install did not help...  %)

valdir.marcos:
Some properties for you to check (TIBConnection, TSQLQuery and TSQLTransaction components):
http://wiki.freepascal.org/SqlDBHowto#How_to_connect_to_a_database_server.3F
http://wiki.freepascal.org/Firebird
http://forum.lazarus.freepascal.org/index.php/topic,37238.msg249685.html#msg249685
http://forum.lazarus.freepascal.org/index.php/topic,34145.msg222957.html#msg222957
http://forum.lazarus.freepascal.org/index.php/topic,3485.msg122877.html#msg122877


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function CreateDataBaseConnection(): integer;  begin    FConnection := TIBConnection.Create(nil);    FTransaction := TSQLTransaction.Create(nil);    Result := 0;    try      try        FConnection.HostName := 'myHost';        FConnection.DatabaseName := 'myDataBaseName.gdb';        FConnection.UserName := 'sysdba';        FConnection.Password := 'masterkey';        FConnection.CharSet := 'ISO8859_1';        FConnection.Dialect := 3;        FConnection.Params.Add('PAGE_SIZE=8194');        FConnection.LoginPrompt := False;        FTransaction.Active := False;        FConnection.Connected := True;         FTransaction.DataBase := FConnection;        FTransaction.Params.Add('isc_tpb_read_committed');  // Transaction isolation levels        FTransaction.Params.Add('isc_tpb_read');            // Access mode        FTransaction.Params.Add('isc_tpb_nowait');          // Lock resolution        FTransaction.Params.Add('isc_tpb_rec_version');     // Record versions         FTransaction.StartTransaction;         Result := GetSQLResult();       except        on e: Exception do        begin          WriteLn('Error ', e.Message);        end;      end;    finally      FTransaction.Commit;      FTransaction.Free;      FConnection.Connected := False;      FConnection.Free;    end;  end;

Navigation

[0] Message Index

[#] Next page

Go to full version