Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / June 2004

Tip: Looking for answers? Try searching our database.

JDBC Event

Thread view: 
Rob McDonald - 28 Jun 2004 19:50 GMT
I'm using Java & JDBC to work with a mySQL database.

I'd like my application to be set off on a course of action when something
in the database is changed.  i.e. I'd like the Java app to be an event
listener that listens to the mySQL database for an entry to be updated or
added.

What is the best way to make this happen?

Thanks,

          Rob
Roedy Green - 28 Jun 2004 20:08 GMT
>I'd like my application to be set off on a course of action when something
>in the database is changed.  i.e. I'd like the Java app to be an event
>listener that listens to the mySQL database for an entry to be updated or
>added.
>
>What is the best way to make this happen?

You need a database that has triggers -- application code that runs
when various things happen.  You need a more advanced SQL engine for
that.  I don't know if any of the free ones support them.

For a list of possibilities see http://mindprod.com/jgloss/sql.html

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Robert Klemme - 29 Jun 2004 09:27 GMT
> >I'd like my application to be set off on a course of action when something
> >in the database is changed.  i.e. I'd like the Java app to be an event
[quoted text clipped - 8 lines]
>
> For a list of possibilities see http://mindprod.com/jgloss/sql.html

Even then the question is whether you could make the trigger call back
into you Java application.  I doubt that.  I could imagine that this is
somehow possible with Oracle's server side Java support.

Alternatively if your application is the only client of the database you
could put some code in the persistence layer or write a JDBC wrapper that
does the triggering.

Regards

   robert
Tod Landis - 29 Jun 2004 15:05 GMT
Check out:
http://dev.mysql.com/doc/mysql/en/ANSI_diff_Triggers.html

- Tod
Roedy Green - 29 Jun 2004 16:50 GMT
>Even then the question is whether you could make the trigger call back
>into you Java application.  I doubt that.

If your DB Trigger language is Java, you are likely running in a
different JVM than the method you want to talk to, but that does not
mean communication is impossible. You still have sockets, pollable
records, RMI etc. as possible routes of communication.

see http://mindprod.com/jgloss/remotefileio.html

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Robert Klemme - 29 Jun 2004 17:23 GMT
> >Even then the question is whether you could make the trigger call back
> >into you Java application.  I doubt that.
[quoted text clipped - 3 lines]
> mean communication is impossible. You still have sockets, pollable
> records, RMI etc. as possible routes of communication.

Yes, of course.  But I chances are you'll have to implement the
communication on your own (using plain sockets, RMI, CORBA or whatever).

If SP language != Java, then it's even more difficult, although I guess
it's possible to implement SP's in C or some other language where you can
do IO and networking.

Regards

   robert

> see http://mindprod.com/jgloss/remotefileio.html


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.