no postgresql user name specified in startup packet

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply

Have you had this issue?

Yes
1
33%
No
1
33%
Huh?
1
33%
 
Total votes: 3

coderdan
Posts: 8
Joined: Mon 09 Mar 2009 16:21
Location: Gig Harbor, WA USA

no postgresql user name specified in startup packet

Post by coderdan » Fri 23 Oct 2009 20:56

Hi guys,

anyone else have this issue? I have an application (D7). I can generally force this to happen if I change my bound IP address (such as connect to a VPN and then disconnect).

I typically will notice this when I call 'FStoredProc.PrepareSQL;' Where FStoredProc is a TpgStoredProcedure. If I on the other hand create all of the params by hand and then fill them this issue does NOT occur.

Thoughts?

Thanks,

Dan

BTW -- High praise for Devart :) Your components are great.

coderdan
Posts: 8
Joined: Mon 09 Mar 2009 16:21
Location: Gig Harbor, WA USA

Solution

Post by coderdan » Sun 25 Oct 2009 18:21

By switching from:
FStoredProc.Connection := Conn;
FStoredProc.StoredProcName := 'spLog';
FStoredProc.Prepare; // or PrepareSQL

FStoredProc.Params[1].AsInteger := FMessageType;
FStoredProc.Params[2].AsString := FMessage;
FStoredProc.Params[3].AsInteger := FUserID;

FStoredProc.Execute;


To:
FStoredProc.Connection := Conn;
FStoredProc.StoredProcName := 'spLog';
FStoredProc.Params.CreateParam(ftInteger,'result',ptResult);
FStoredProc.Params.CreateParam(ftInteger, 'log_type',ptInput);
FStoredProc.Params.CreateParam(ftString,'log_msg',ptInput);
FStoredProc.Params.CreateParam(ftInteger,'log_user', ptInput);

FStoredProc.Params[1].AsInteger := FMessageType;
FStoredProc.Params[2].AsString := FMessage;
FStoredProc.Params[3].AsInteger := FUserID;

FStoredProc.Execute;

I only find this to be a problem when called from with a thread. Ok, well I suppose it's the finesse of the style :)

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 27 Oct 2009 08:04

When your IP address is changed, the PostgreSQL server cannot detect that data you send belongs to the same connection. The server thinks that it is a new connection. So it returns an error.

coderdan
Posts: 8
Joined: Mon 09 Mar 2009 16:21
Location: Gig Harbor, WA USA

Thank you -- and so...

Post by coderdan » Tue 27 Oct 2009 17:26

is there a connection event that can trap this?

Thanks

Dan

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 28 Oct 2009 09:42

You can try to use the OnConnectionLost event. Set the LocalFailover option of TPgConnection to True to enable this event. See the "Using PgDAC / Working in an Unstable Network" topic in the PgDAC help for details.

Post Reply