PgSQLAlerter on connection close
Posted: Sun 16 Apr 2017 10:18
Hi,
i'm bit confused.
After i started eventalerter, i normaly do some select or update, we open connection, so what we need, and then close connection. As i understand, connection isn't closed at all. After closed connection, i see that in postgres server are still two connections (one for alerter and one i created), but alerting isnt working anymore. If i comment out myConn.Close(); then it works. Also, there is nothing on those events raising Sopped and Error. So i dont get it, everything shows, that it should work, but its not working.
Thx for help!
i'm bit confused.
Code: Select all
{
PgSqlAlerter ZPgEventAlerter = new PgSqlAlerter();
PgSqlConnection myConn = new PgSqlConnection();
public Form1()
{
PgSqlConnectionStringBuilder builder = new PgSqlConnectionStringBuilder();
builder.ConnectionString = "host=localhost;database=db;user id=postgres;password=postgres";
builder.ApplicationName = "APP";
myConn.ConnectionString = builder.ConnectionString;
InitializeComponent();
ZPgEventAlerter.Connection = myConn;
ZPgEventAlerter.AlertNames = "shift_update";
ZPgEventAlerter.Alert += ZPgEventAlerter_Alert; ;
ZPgEventAlerter.Stopped += ZPgEventAlerter_Stopped;
ZPgEventAlerter.Error += ZPgEventAlerter_Error;
ZPgEventAlerter.Start();
myConn.Open();
//doing some select
myConn.Close();
}
Thx for help!