postgresql - Lazarus + Postgres: incomplete startup packet -
i've been building lazarus pascal program using postgresql on back-end. used work fine following lines opening db.
dbconn:= tpqconnection.create(nil); dbconn.hostname := 'localhost'; dbconn.databasename:= 'dbhrs'; dbconn.username:='mizk'; dbconn.password:='123'; dbconn.open; if dbconn.connected openhrsdb := true else openhrsdb := false;
but moment change localhost server's ip (on lan), program stops. no errors or warnings. have no clue happening.
here related details may narrow down problem.
- the program i'm running workstation on same lan server.
- both machines run ubuntu 12.04 desktop
- i can access postgres db on server using pgadmin iii, guess it's not firewall issue.
- i have allowed postgresql ufw , ufw disabled.
- strangely, when firewall disabled, can ssh server terminal using workstation. when it's enabled, can't
my biggest concern right why pascal program not working when ip number given , message in postgres log.
any inputs appreciated. thanks!
edit: here's more info:
the file postgresql.conf contains these lines:
listen_addresses = '*'
port = 5430
so sorry... here's correct log after connection logging turned on. log file contains after shutdown, restarted , run program:
2014-03-06 18:28:23 ist log: database system shut down @ 2014-03-06 18:28:22 ist 2014-03-06 18:28:23 ist log: connection received: host=[local] 2014-03-06 18:28:23 ist log: incomplete startup packet 2014-03-06 18:28:23 ist log: database system ready accept connections 2014-03-06 18:28:23 ist log: autovacuum launcher started 2014-03-06 18:28:24 ist log: connection received: host=[local] 2014-03-06 18:28:24 ist log: connection authorized: user=postgres database=postgres 2014-03-06 18:28:24 ist log: connection received: host=[local] 2014-03-06 18:28:24 ist log: connection authorized: user=postgres database=postgres 2014-03-06 18:28:25 ist log: connection received: host=[local] 2014-03-06 18:28:25 ist log: connection authorized: user=postgres database=postgres 2014-03-06 18:28:29 ist log: connection received: host=[local] 2014-03-06 18:28:29 ist log: incomplete startup packet
i realised missing when found link talked port: http://lists.lazarus.freepascal.org/pipermail/lazarus/2009-august/044403.html
so included following line in code connect: dbconn.params.text := 'port=5430';
i'm not sure if correct way of doing connection string because thinking there may other parameters in connection string used , above method may over-write params. reason put first line.
so method has worked me.
there's method tried did not work me. use append method (dbconn.params.append)
i found out parameters case-sensitive , had write 'port' ('port' did not work).
Comments
Post a Comment