You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bill Davidson <bi...@gmail.com> on 2009/01/06 23:22:52 UTC
Oracle database calling the web app?
Is it possible to set up a callback like situation so that a trigger in an
Oracle 10g database can call a method in a currently running webapp
that's running in Tomcat 6?
My situation is that I want to cache some infrequently changed database
data in memory but when that data does change in the database, I want
the web applications, running on multiple servers, to immediately pick
up the change.
Right now, one idea I have for this is to have the database trigger
create a file in a file system that's shared by the database server and
the application servers and have the web apps check for the existence
of this file to know whether to update the cache. It feels ugly and
means hitting a networked file system a lot but it seems like it should
work and it seems like it should not be as bad as hitting the database
constantly for something that doesn't change very often.
I'd rather have the database send a message somehow to the web app that
it needs to update its cache of the data. Any suggestions?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Youssef Mohammed <yo...@gmail.com>.
an asynchronous solution is definitely a better solution but either ways,
you have to call some web services at the end to notify the web app , no ?
Regards, Youssef
On Wed, Jan 7, 2009 at 12:35 AM, Edward Dowgiallo <ed...@gmail.com>wrote:
> This is also highly inefficient. You are taking on all the additional
> overhead of a web service call for no reason.
>
> Ed
>
> On Tue, Jan 6, 2009 at 5:31 PM, Youssef Mohammed <
> youssef.mohammed@gmail.com
> > wrote:
>
> > you can also have your trigger call a java package where you can simply
> > call
> > a web service (SOAP or RESTful).
> >
> >
> > Regards, Youssef
> >
> >
> > On Wed, Jan 7, 2009 at 12:26 AM, Edward Dowgiallo <eddowgiallo@gmail.com
> > >wrote:
> >
> > > Support for what you want to do is actually a feature in Oracle 11g.
> For
> > > Oracle 10g, you want to look at the publish/subscribe support which is
> > part
> > > of advanced queueing. The documentation is available online at
> > > http://otn.oracle.com.
> > >
> > > Ed
> > >
> > > On Tue, Jan 6, 2009 at 5:22 PM, Bill Davidson <bi...@gmail.com>
> wrote:
> > >
> > > > Is it possible to set up a callback like situation so that a trigger
> in
> > > an
> > > > Oracle 10g database can call a method in a currently running webapp
> > > > that's running in Tomcat 6?
> > > >
> > > > My situation is that I want to cache some infrequently changed
> database
> > > > data in memory but when that data does change in the database, I want
> > > > the web applications, running on multiple servers, to immediately
> pick
> > > > up the change.
> > > >
> > > > Right now, one idea I have for this is to have the database trigger
> > > > create a file in a file system that's shared by the database server
> and
> > > > the application servers and have the web apps check for the existence
> > > > of this file to know whether to update the cache. It feels ugly and
> > > > means hitting a networked file system a lot but it seems like it
> should
> > > > work and it seems like it should not be as bad as hitting the
> database
> > > > constantly for something that doesn't change very often.
> > > >
> > > > I'd rather have the database send a message somehow to the web app
> that
> > > > it needs to update its cache of the data. Any suggestions?
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> > >
> >
>
Re: Oracle database calling the web app?
Posted by Edward Dowgiallo <ed...@gmail.com>.
This is also highly inefficient. You are taking on all the additional
overhead of a web service call for no reason.
Ed
On Tue, Jan 6, 2009 at 5:31 PM, Youssef Mohammed <youssef.mohammed@gmail.com
> wrote:
> you can also have your trigger call a java package where you can simply
> call
> a web service (SOAP or RESTful).
>
>
> Regards, Youssef
>
>
> On Wed, Jan 7, 2009 at 12:26 AM, Edward Dowgiallo <eddowgiallo@gmail.com
> >wrote:
>
> > Support for what you want to do is actually a feature in Oracle 11g. For
> > Oracle 10g, you want to look at the publish/subscribe support which is
> part
> > of advanced queueing. The documentation is available online at
> > http://otn.oracle.com.
> >
> > Ed
> >
> > On Tue, Jan 6, 2009 at 5:22 PM, Bill Davidson <bi...@gmail.com> wrote:
> >
> > > Is it possible to set up a callback like situation so that a trigger in
> > an
> > > Oracle 10g database can call a method in a currently running webapp
> > > that's running in Tomcat 6?
> > >
> > > My situation is that I want to cache some infrequently changed database
> > > data in memory but when that data does change in the database, I want
> > > the web applications, running on multiple servers, to immediately pick
> > > up the change.
> > >
> > > Right now, one idea I have for this is to have the database trigger
> > > create a file in a file system that's shared by the database server and
> > > the application servers and have the web apps check for the existence
> > > of this file to know whether to update the cache. It feels ugly and
> > > means hitting a networked file system a lot but it seems like it should
> > > work and it seems like it should not be as bad as hitting the database
> > > constantly for something that doesn't change very often.
> > >
> > > I'd rather have the database send a message somehow to the web app that
> > > it needs to update its cache of the data. Any suggestions?
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>
Re: Oracle database calling the web app?
Posted by Youssef Mohammed <yo...@gmail.com>.
you can also have your trigger call a java package where you can simply call
a web service (SOAP or RESTful).
Regards, Youssef
On Wed, Jan 7, 2009 at 12:26 AM, Edward Dowgiallo <ed...@gmail.com>wrote:
> Support for what you want to do is actually a feature in Oracle 11g. For
> Oracle 10g, you want to look at the publish/subscribe support which is part
> of advanced queueing. The documentation is available online at
> http://otn.oracle.com.
>
> Ed
>
> On Tue, Jan 6, 2009 at 5:22 PM, Bill Davidson <bi...@gmail.com> wrote:
>
> > Is it possible to set up a callback like situation so that a trigger in
> an
> > Oracle 10g database can call a method in a currently running webapp
> > that's running in Tomcat 6?
> >
> > My situation is that I want to cache some infrequently changed database
> > data in memory but when that data does change in the database, I want
> > the web applications, running on multiple servers, to immediately pick
> > up the change.
> >
> > Right now, one idea I have for this is to have the database trigger
> > create a file in a file system that's shared by the database server and
> > the application servers and have the web apps check for the existence
> > of this file to know whether to update the cache. It feels ugly and
> > means hitting a networked file system a lot but it seems like it should
> > work and it seems like it should not be as bad as hitting the database
> > constantly for something that doesn't change very often.
> >
> > I'd rather have the database send a message somehow to the web app that
> > it needs to update its cache of the data. Any suggestions?
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
Re: Oracle database calling the web app?
Posted by Bill Davidson <bi...@gmail.com>.
Ken Bowen wrote:
> Whoops, hold that. This is ok for outbound. For inbound, it seems
> Jboss is needed: http://activemq.apache.org/jboss-integration.html
I'm not sure I understand how that says JBoss is needed to do inbound
communications.
There is a page on configuring Tomcat:
http://activemq.apache.org/tomcat.html
I'm finding the ActiveMQ docs less than obvious. I'm not entirely clear
on what it is I'm trying to do when setting this up.
I'm confused about whether I need to run ActiveMQ as a stand alone
process with a connector to Tomcat or whether I can run ActiveMQ
inside Tomcat (is that what they mean by embeded?). The latter sounds
better.
I've had no luck finding an "Introduction to setting up ActiveMQ with
Tomcat for people who've never set up JMS before" tutorial.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Ken Bowen <kb...@als.com>.
Whoops, hold that. This is ok for outbound. For inbound, it seems
Jboss is needed: http://activemq.apache.org/jboss-integration.html
On Jan 6, 2009, at 6:51 PM, Ken Bowen wrote:
> It's possible to integrate Tomcat and ActiveMQ (a JMS superset): http://activemq.apache.org/tomcat.html
>
> On Jan 6, 2009, at 6:08 PM, Bill Davidson wrote:
>
>> Bill Davidson wrote:
>>> Oracle Streams Advanced Queuing User's Guide and Reference
>>
>> Looking through that, it looks like it uses JMS to send a message
>> back to
>> Java. Being on Tomcat, that's a problem. Some searching shows I may
>> be able to use OpenJMS or ActiveMQ to get JMS in Tomcat.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Ken Bowen <kb...@als.com>.
It's possible to integrate Tomcat and ActiveMQ (a JMS superset): http://activemq.apache.org/tomcat.html
On Jan 6, 2009, at 6:08 PM, Bill Davidson wrote:
> Bill Davidson wrote:
>> Oracle Streams Advanced Queuing User's Guide and Reference
>
> Looking through that, it looks like it uses JMS to send a message
> back to
> Java. Being on Tomcat, that's a problem. Some searching shows I may
> be able to use OpenJMS or ActiveMQ to get JMS in Tomcat.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Bill Davidson <bi...@gmail.com>.
Bill Davidson wrote:
> Oracle Streams Advanced Queuing User's Guide and Reference
Looking through that, it looks like it uses JMS to send a message back to
Java. Being on Tomcat, that's a problem. Some searching shows I may
be able to use OpenJMS or ActiveMQ to get JMS in Tomcat.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Bill Davidson <bi...@gmail.com>.
Edward Dowgiallo wrote:
> Support for what you want to do is actually a feature in Oracle 11g. For
> Oracle 10g, you want to look at the publish/subscribe support which is part
> of advanced queueing. The documentation is available online at
> http://otn.oracle.com.
>
Is this the book I should be reading?
Oracle Streams Advanced Queuing User's Guide and Reference
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Edward Dowgiallo <ed...@gmail.com>.
Support for what you want to do is actually a feature in Oracle 11g. For
Oracle 10g, you want to look at the publish/subscribe support which is part
of advanced queueing. The documentation is available online at
http://otn.oracle.com.
Ed
On Tue, Jan 6, 2009 at 5:22 PM, Bill Davidson <bi...@gmail.com> wrote:
> Is it possible to set up a callback like situation so that a trigger in an
> Oracle 10g database can call a method in a currently running webapp
> that's running in Tomcat 6?
>
> My situation is that I want to cache some infrequently changed database
> data in memory but when that data does change in the database, I want
> the web applications, running on multiple servers, to immediately pick
> up the change.
>
> Right now, one idea I have for this is to have the database trigger
> create a file in a file system that's shared by the database server and
> the application servers and have the web apps check for the existence
> of this file to know whether to update the cache. It feels ugly and
> means hitting a networked file system a lot but it seems like it should
> work and it seems like it should not be as bad as hitting the database
> constantly for something that doesn't change very often.
>
> I'd rather have the database send a message somehow to the web app that
> it needs to update its cache of the data. Any suggestions?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Oracle database calling the web app?
Posted by Edward Dowgiallo <ed...@gmail.com>.
It is not necessary to poll an Oracle database. Advanced queueing in
combination with triggers provide an event driven framework.
Ed
On Tue, Jan 6, 2009 at 5:28 PM, Mark Thomas <ma...@apache.org> wrote:
> Bill Davidson wrote:
> > Is it possible to set up a callback like situation so that a trigger in
> an
> > Oracle 10g database can call a method in a currently running webapp
> > that's running in Tomcat 6?
> >
> > My situation is that I want to cache some infrequently changed database
> > data in memory but when that data does change in the database, I want
> > the web applications, running on multiple servers, to immediately pick
> > up the change.
> >
> > Right now, one idea I have for this is to have the database trigger
> > create a file in a file system that's shared by the database server and
> > the application servers and have the web apps check for the existence
> > of this file to know whether to update the cache. It feels ugly and
> > means hitting a networked file system a lot but it seems like it should
> > work and it seems like it should not be as bad as hitting the database
> > constantly for something that doesn't change very often.
> >
> > I'd rather have the database send a message somehow to the web app that
> > it needs to update its cache of the data. Any suggestions?
>
> 1. JMS?
> 2. Call an reload servlet from the database?
> 3. Drop the immediate update requirement and poll a data changed flag in
> the db
> every x seconds?
>
> Personally, I'd go with 3. For a simple flag this could be every few
> seconds
> with very little load on the db or Tomcat and would take all of a few
> minutes to
> code.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
RE: Oracle database calling the web app?
Posted by Martin Gainty <mg...@hotmail.com>.
Placing a request in a queue such as JMS is One way to accomplish the objective
In the meanwhile take a look at the doc on how to setup an Oracle job at
http://www.psoug.org/reference/dbms_job.html
And Burlesons site has some information on how to create and call a job
http://www.dba-oracle.com/tips_oracle_dbms_job.htm
Feel free to contact me offline for solutions as this most definitely "Oracle specific" and not necessarily related to TOMCAT
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
> Date: Thu, 15 Jan 2009 09:49:53 -0500
> From: chris@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: Oracle database calling the web app?
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bill,
>
> Bill Davidson wrote:
> > Mark Thomas wrote:
> >>1. JMS?
> >
> > I thought Tomcat didn't support JMS. Am I wrong about this?
>
> Tomcat doesn't /provide/ JMS. You can add any JSM-compatible library to
> Tomcat (really, your own application) that you want.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAklvTBYACgkQ9CaO5/Lv0PC14wCfXiKvbDG66RCLbFlmpizfRYo7
> vxoAnRQFqwD3k8lfi15ZLkWMeAjaXtTx
> =V8nq
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
_________________________________________________________________
Windows Liveā¢: Keep your life in sync.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009
Re: Oracle database calling the web app?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Bill,
Bill Davidson wrote:
> Mark Thomas wrote:
>>1. JMS?
>
> I thought Tomcat didn't support JMS. Am I wrong about this?
Tomcat doesn't /provide/ JMS. You can add any JSM-compatible library to
Tomcat (really, your own application) that you want.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAklvTBYACgkQ9CaO5/Lv0PC14wCfXiKvbDG66RCLbFlmpizfRYo7
vxoAnRQFqwD3k8lfi15ZLkWMeAjaXtTx
=V8nq
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Bill Davidson <bi...@gmail.com>.
Mark Thomas wrote:
>1. JMS?
I thought Tomcat didn't support JMS. Am I wrong about this?
>2. Call an reload servlet from the database?
Sounds slightly painful but at least it's event driven.
>3. Drop the immediate update requirement and poll a data changed flag
in the db
>every x seconds?
Still not event driven like I'd like but it might be acceptable.
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Mark Thomas <ma...@apache.org>.
Bill Davidson wrote:
> Is it possible to set up a callback like situation so that a trigger in an
> Oracle 10g database can call a method in a currently running webapp
> that's running in Tomcat 6?
>
> My situation is that I want to cache some infrequently changed database
> data in memory but when that data does change in the database, I want
> the web applications, running on multiple servers, to immediately pick
> up the change.
>
> Right now, one idea I have for this is to have the database trigger
> create a file in a file system that's shared by the database server and
> the application servers and have the web apps check for the existence
> of this file to know whether to update the cache. It feels ugly and
> means hitting a networked file system a lot but it seems like it should
> work and it seems like it should not be as bad as hitting the database
> constantly for something that doesn't change very often.
>
> I'd rather have the database send a message somehow to the web app that
> it needs to update its cache of the data. Any suggestions?
1. JMS?
2. Call an reload servlet from the database?
3. Drop the immediate update requirement and poll a data changed flag in the db
every x seconds?
Personally, I'd go with 3. For a simple flag this could be every few seconds
with very little load on the db or Tomcat and would take all of a few minutes to
code.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Bill Davidson <bi...@gmail.com>.
Juha Laiho wrote:
> However, have you actually measured how much load it would put to various
> pieces of your system to not cache this data, but just fetch it from the
> DB more or less each time it is needed?
>
We currently have the ability to turn the caching on or off. We
generally only
turn it on when we anticipate a massive traffic storm coming to our site
(caused
by new highly in demand items going on sale). At the moment, once we
turn the
cache on, the cached data only gets updated by turning caching off and
then back
on -- which is something we don't like to do when we are getting
thousands of hits
per minute.
While I'm not aware of exact measurements, the system can handle major
traffic loads much better when we have the caching on.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Oracle database calling the web app?
Posted by Juha Laiho <Ju...@iki.fi>.
Bill Davidson wrote:
> Is it possible to set up a callback like situation so that a trigger in an
> Oracle 10g database can call a method in a currently running webapp
> that's running in Tomcat 6?
Yes, there's UTL_HTTP PL/SQL package available in Oracle, which provides
HTTP client functionality. AQ can also do the job, as others have already
told. See f.ex. http://www.psoug.org/reference/utl_http.html for details.
> My situation is that I want to cache some infrequently changed database
> data in memory but when that data does change in the database, I want
> the web applications, running on multiple servers, to immediately pick
> up the change.
As you say it's "on multiple servers", remember that you'll also need to
send the "update" event to multiple destinations. If it were just
a single server, I think you could've arranged things so that also the
update would arrive via the single server.
However, have you actually measured how much load it would put to various
pieces of your system to not cache this data, but just fetch it from the
DB more or less each time it is needed?
> Right now, one idea I have for this is to have the database trigger
> create a file in a file system that's shared by the database server and
> the application servers and have the web apps check for the existence
> of this file to know whether to update the cache. It feels ugly and
> means hitting a networked file system a lot but it seems like it should
> work and it seems like it should not be as bad as hitting the database
> constantly for something that doesn't change very often.
DB's are pretty adept at caching frequently used data (and queries and ...),
so I'm not certain whether you're achieving anything by replacing one
cache with another (esp. if handling the whole use case does anyway
require accessing some data from the same database).
--
..Juha
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org