dbTalk Databases Forums  

Implementing database push

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss Implementing database push in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jason 'Bug' Fenter [TeamSybase]
 
Posts: n/a

Default Implementing database push - 10-19-2009 , 02:31 PM






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.

Reply With Quote
  #2  
Old   
Ian McHardy [Sybase iAnywhere]
 
Posts: n/a

Default Re: Implementing database push - 10-19-2009 , 04:06 PM






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/libr...ere-techcorner
SQL Anywhere Blog Center - http://www.sybase.com/sqlanyblogs
"Jason 'Bug' Fenter [TeamSybase]" <jason.fenter (AT) teamsybase (DOT) com> wrote in
message news:4adcbe87 (AT) forums-1-dub (DOT) ..
Quote:
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.

Reply With Quote
  #3  
Old   
Jason 'Bug' Fenter [TeamSybase]
 
Posts: n/a

Default Re: Implementing database push - 10-19-2009 , 04:38 PM



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?



Ian McHardy [Sybase iAnywhere] wrote:
Quote:
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.

Reply With Quote
  #4  
Old   
Jason 'Bug' Fenter [TeamSybase]
 
Posts: n/a

Default Re: Implementing database push - 10-19-2009 , 04:44 PM



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?


Jason 'Bug' Fenter [TeamSybase] wrote:
Quote:
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?



Ian McHardy [Sybase iAnywhere] wrote:
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.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.