0

how do i connect my delphi 7 app to a local network? i am using zeos and have set up the ZConnection1 hostname setting to the ip of my server in the object inspector, i can connect on the computer i am coding right now but cant connect to the dabatase with another computer from the network. i have set the database path to C:\Documents and Settings\Administrator\My Documents\test.FDB. do i need to change it to an ip address? thanks

the components i used are

  • 1 zconnection
  • 1 ztable
  • 1 data source
  • 1 db grid
Chunk Chunk
  • 143
  • 6
  • 17
  • Perhaps the 3050 port on server is not open? See http://stackoverflow.com/a/15705978/723693 – ain Apr 07 '13 at 18:23
  • possible duplicate of [how do i connect to a firebird database on delphi 7 from multiple clients spread across the internet?](http://stackoverflow.com/questions/15685085/how-do-i-connect-to-a-firebird-database-on-delphi-7-from-multiple-clients-spread). The answer is exactly the same, whether it's across the internet or a local network. – Ken White Apr 07 '13 at 18:31
  • thanks ain. @ken i had trouble accessing my db via the internet that why i am trying first to connect on a local network. – Chunk Chunk Apr 07 '13 at 18:45
  • i tried disabling the firewall and also manually opening the port 3050 and tried changing the port of firebird also but i still cant connect – Chunk Chunk Apr 07 '13 at 19:19
  • im sorry to ask too much but can you guys give me a step by step instruction on setting up a local network connection using zeos to access my database? – Chunk Chunk Apr 07 '13 at 19:25
  • Can you use tools like `IBExpert` or `FlameRobin` to connect from development machine to the server's db? Reduce number of variables. With your app you don't know if the problem is your app error or network/server setup. using standard tools you can make sure client is okay and specifically test lan/server settings. – Arioch 'The Apr 08 '13 at 06:40
  • Most likely the useraccount running the service does not have access to `Administrator` user folder. Put it in a - for the service - accessible location – Mark Rotteveel Apr 08 '13 at 06:59

3 Answers3

1

try

ipserver:C:\Documents and Settings\Administrator\My Documents\test.FDB

where ipserver is the name or ip of your computer.

Greg M.
  • 229
  • 1
  • 9
  • tried the code you gave but there an error that says invalid databse handle erro code 904 unsuccessful execution caused by an unavailable source. tried putting it in the database and hostname field on the object inspector. – Chunk Chunk Apr 07 '13 at 17:33
  • ok, put localhost 'hostname', and the file path in 'database'. If it works, try with the real ip of your pc. – Greg M. Apr 07 '13 at 17:35
  • localhost and file path works, but when i tried the one you posted it cant connect. – Chunk Chunk Apr 07 '13 at 17:40
  • sorry, i don't understand the problem .... Replace localhost with the ip of your pc, and check your firewall settings. – Greg M. Apr 07 '13 at 18:35
  • im sorry also. i just want to connect to my database using my app on another pc that is connected at the same network. but perhaps i cant, i tried putting the ip of the server pc to the localhost and file path like you mentioned but still i am having errors. – Chunk Chunk Apr 07 '13 at 18:57
  • im sorry to ask too much but can you guys give me a step by step instruction on setting up a local network connection using zeos to access my database? – Chunk Chunk Apr 07 '13 at 19:30
  • localhost means "connect to the local server". If it works then, it means that the server is up and running. It won't work from a distant pc. So next, change your localhost to the real ip of your server, and test from the other pc, it should work. – Greg M. Apr 07 '13 at 20:05
  • i have tried changing the local host to a real ip (server ip) but when i click the connect on the object inspector i always shows an error. even on firebird i cant connect to the server database. – Chunk Chunk Apr 08 '13 at 03:58
  • 2
    1: use sysinternals `Process Monitor` and see if your application actually makes connection attempt to `ipserver` to 3070 port. 2: is Firebird Server is running on that `ipserver` machine and not jailed by firewall? use SI PI to check if there are incoming connections to fbserver on `ipserver` machine. 3: Should not be critical but as a matter of safe and flexible setup, you'd better user `aliases.conf` file on server to avoid putting complete file path on the connection string – Arioch 'The Apr 08 '13 at 06:38
0

As far as I can tell from the TZConnection class documentation, you need to set the properties HostName, Port (might be optional) and Database (only the database alias or full path, no hostname).

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
0

@airoch 'the

thanks for the tip. got my app working two days ago just got some internet problem that why i havent posted.

i just changed the alias in aliases.conf and it worked! thanks to all the experts who gave time to my post!

Chunk Chunk
  • 143
  • 6
  • 17