Redian新闻
>
How to implement pushing data from database to user?
avatar
How to implement pushing data from database to user?# Java - 爪哇娇娃
p*u
1
帖一首老歌,让大家“想入非非”在梦里呼呼吧~~ xixi..
avatar
c*o
2
How to implement this in JAVA?
Does any body know in oracle database, if data is changed, how to java
system get informed then sent notify to client?
I thought database trigger can monitor the data changes, but it can not
inform java system, right?
avatar
wh
3
haha, hot.

【在 p****u 的大作中提到】
: 帖一首老歌,让大家“想入非非”在梦里呼呼吧~~ xixi..
avatar
g*g
4
Depends on how real time it is needed. Usually you can use a java thread
to check certain DB field periodly (poll) to notice the change.

【在 c**o 的大作中提到】
: How to implement this in JAVA?
: Does any body know in oracle database, if data is changed, how to java
: system get informed then sent notify to client?
: I thought database trigger can monitor the data changes, but it can not
: inform java system, right?

avatar
x*n
5
吼吼
avatar
c*o
6
I think this way should not be very efficient, since the thread runs all the
time, and in every checkup the thread should make a query, right?

【在 g*****g 的大作中提到】
: Depends on how real time it is needed. Usually you can use a java thread
: to check certain DB field periodly (poll) to notice the change.

avatar
g*g
7
A sql query usually takes less time than you'd think. It's going to be
ms level. I'd say this is sufficient for most projects. You don't worry
about performance until performance is a problem.

the

【在 c**o 的大作中提到】
: I think this way should not be very efficient, since the thread runs all the
: time, and in every checkup the thread should make a query, right?

avatar
c*t
8
1. there is no way to do it with pushing.
2. pushing (in general) is nearly always a bad idea (in terms of performance
etc).

the

【在 c**o 的大作中提到】
: I think this way should not be very efficient, since the thread runs all the
: time, and in every checkup the thread should make a query, right?

avatar
c*o
9
Can you give me a hint why you pick up thread, not a simple loop?
the two ways look like the same to me. And for real implement, thread is
much more difficult to deal with than loop.

【在 g*****g 的大作中提到】
: A sql query usually takes less time than you'd think. It's going to be
: ms level. I'd say this is sufficient for most projects. You don't worry
: about performance until performance is a problem.
:
: the

avatar
g*g
10
Usually you don't want to lock up the main application, if that's
not a problem, go ahead and do whatever is simple for you.

【在 c**o 的大作中提到】
: Can you give me a hint why you pick up thread, not a simple loop?
: the two ways look like the same to me. And for real implement, thread is
: much more difficult to deal with than loop.

avatar
s*d
11
polling by querying is not a bad idea if the query is not that complex and
time consuming.
if you are using oracle 11g, you may also consider a new feature called
Database Change Notification. Basically you can register a query in Java to
the JDBC layer, and database will notify it when the result set of the query
changes. http://www.oracle.com/technology/obe/hol08/11gR1_JDBC_Java/dcn_otn.htm
another possibility (if you need near-real time alerts), might be to use
triggers and make an HTTP POST
avatar
c*o
12
Thanks, it helps. But I don't know how to make an http post call inside the
trigger.It is new feature in oracle 10g? or 11g? Can you give me a simple
example.

to
query

【在 s****d 的大作中提到】
: polling by querying is not a bad idea if the query is not that complex and
: time consuming.
: if you are using oracle 11g, you may also consider a new feature called
: Database Change Notification. Basically you can register a query in Java to
: the JDBC layer, and database will notify it when the result set of the query
: changes. http://www.oracle.com/technology/obe/hol08/11gR1_JDBC_Java/dcn_otn.htm
: another possibility (if you need near-real time alerts), might be to use
: triggers and make an HTTP POST

avatar
c*o
13
for the first, I don't know, I am trying to find out here.
The second, Why? it supposes to be efficient than pulling, right?

performance

【在 c*****t 的大作中提到】
: 1. there is no way to do it with pushing.
: 2. pushing (in general) is nearly always a bad idea (in terms of performance
: etc).
:
: the

avatar
c*o
14
Thanks, make sense.

【在 g*****g 的大作中提到】
: Usually you don't want to lock up the main application, if that's
: not a problem, go ahead and do whatever is simple for you.

avatar
s*n
15
who changed the data?

【在 c**o 的大作中提到】
: How to implement this in JAVA?
: Does any body know in oracle database, if data is changed, how to java
: system get informed then sent notify to client?
: I thought database trigger can monitor the data changes, but it can not
: inform java system, right?

avatar
s*e
16
Oracle has built-in java support. You might be able to take advantage of it.
sleeping and poll can be an idea, but for me a more elegant way is using
MOM such as JMS message broker.
avatar
s*d
18
you should look up the PL/SQL package called utl_http which can be used to
send
http requests.

the

【在 c**o 的大作中提到】
: Thanks, it helps. But I don't know how to make an http post call inside the
: trigger.It is new feature in oracle 10g? or 11g? Can you give me a simple
: example.
:
: to
: query

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。