Discussion:
Implementing database push
(too old to reply)
Jason 'Bug' Fenter [TeamSybase]
2009-10-19 19:31:19 UTC
Permalink
Is there any way to push notification from the database to a
PowerBuilder application? I've played around with the "MESSAGE"
statement with no luck.

Background:
I have two applications on two different machines. App 1 inserts data
into the database. App 2 needs to see this new data in as close to real
time as possible. Currently, I have to have app 2 poll the database for
changes. :( It would be much more elegant if the database could push
some kind (any kind) of notification to app2 when app1 did an insert.
Ian McHardy [Sybase iAnywhere]
2009-10-19 21:06:12 UTC
Permalink
In 9.0.1 the MESSAGE ... FOR CONNECTION feature was added that allows a
message to be sent to another connection. The connection receiving the
message would get the message through a callback function when the current
request finished, or promptly if a WAITFOR DELAY statement was executing.
In 11.0.1 the MESSAGE ... FOR CONNECTION ... IMMEDIATE syntax was added
which allowed a second connection to receive a message promptly without
needing to be making requests or be executing the WAITFOR DELAY statement.

That said, I'm not sure if it is possible to register the ODBC message
callback function from PowerBuilder. The message callback function is
registered using the SQLSetConnectAttr( ... SA_REGISTER_MESSAGE_CALLBACK
... ) ODBC call.
--
Ian McHardy (Sybase iAnywhere)

Please reply only to the newsgroup.

SQL Anywhere 11 FAQ - http://www.sybase.com/detail?id=1064084
SQL Anywhere Developer Community -
http://www.sybase.com/developer/library/sql-anywhere-techcorner
SQL Anywhere Blog Center - http://www.sybase.com/sqlanyblogs
Is there any way to push notification from the database to a PowerBuilder
application? I've played around with the "MESSAGE" statement with no luck.
I have two applications on two different machines. App 1 inserts data into
the database. App 2 needs to see this new data in as close to real time as
possible. Currently, I have to have app 2 poll the database for changes.
:( It would be much more elegant if the database could push some kind (any
kind) of notification to app2 when app1 did an insert.
Jason 'Bug' Fenter [TeamSybase]
2009-10-19 21:38:40 UTC
Permalink
No, PowerBuilder does not support callback functions at all. The SQLAny
help file for WAITFOR contains this bit of SQL code:
SET msg = CONNECTION_PROPERTY('MessageReceived');

Any idea how I would pull back that CONNECTION_PROPERTY() thing from a
PB / ODBC client?
Post by Ian McHardy [Sybase iAnywhere]
In 9.0.1 the MESSAGE ... FOR CONNECTION feature was added that allows a
message to be sent to another connection. The connection receiving the
message would get the message through a callback function when the current
request finished, or promptly if a WAITFOR DELAY statement was executing.
In 11.0.1 the MESSAGE ... FOR CONNECTION ... IMMEDIATE syntax was added
which allowed a second connection to receive a message promptly without
needing to be making requests or be executing the WAITFOR DELAY statement.
That said, I'm not sure if it is possible to register the ODBC message
callback function from PowerBuilder. The message callback function is
registered using the SQLSetConnectAttr( ... SA_REGISTER_MESSAGE_CALLBACK
... ) ODBC call.
Jason 'Bug' Fenter [TeamSybase]
2009-10-19 21:44:34 UTC
Permalink
Doh! I just have to put it into a SELECT statement.

SELECT CONNECTION_PROPERTY( 'MessageReceived' ) FROM dummy;

Maybe I'll have this working by the end of the day, eh? :D
Post by Jason 'Bug' Fenter [TeamSybase]
No, PowerBuilder does not support callback functions at all. The SQLAny
SET msg = CONNECTION_PROPERTY('MessageReceived');
Any idea how I would pull back that CONNECTION_PROPERTY() thing from a
PB / ODBC client?
Post by Ian McHardy [Sybase iAnywhere]
In 9.0.1 the MESSAGE ... FOR CONNECTION feature was added that allows
a message to be sent to another connection. The connection receiving
the message would get the message through a callback function when the
current request finished, or promptly if a WAITFOR DELAY statement was
executing. In 11.0.1 the MESSAGE ... FOR CONNECTION ... IMMEDIATE
syntax was added which allowed a second connection to receive a
message promptly without needing to be making requests or be executing
the WAITFOR DELAY statement.
That said, I'm not sure if it is possible to register the ODBC message
callback function from PowerBuilder. The message callback function is
registered using the SQLSetConnectAttr( ...
SA_REGISTER_MESSAGE_CALLBACK ... ) ODBC call.
Loading...