• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deleting from database(simple)

 
Murasoli Maran
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
my site is in JSP + mySQL
customer can join to the site through membership form.
i want to remove a customer from my database if he is not purchasing any items within 7 days.
how to achieve this?..i think this can be done with a database Trigger.but mySQL does'nt support Triggers.so what will be the possible solution?.
this is a common problom.i think most coders may have done this before.becoz i hav seen this in most websites.
thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65125
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This hasn't much to do with JSP per se, so I'm moving it along to the JDBC forum.
bear
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34863
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Murasoli,
You could have a java class that uses jdbc to run the delete query. Set up a java thread (or batch process) to run this however often you would have had the trigger run.
 
Murasoli Maran
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
can u tell me how to make a batch jon in winXP?.i heard abt cruntab ..but i donno how to use it.
my query is
delete from table1;
i wanna run this script in every 6 AM.
do u giv me an example?.plz share ur exp.
thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34863
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Murasoli,
Crontab is for UNIX. For Windows, you have to use windows scheduler. The third post on this page describes the details. In the scheduler entry, you would run:
>java ProgramToDeleteFromDatabase
I assume you have a where clause in the delete query? You just write up a small program (with a main method) that uses JDBC to run the query. The code should look just like your JDBC code in the regular application.
 
Murasoli Maran
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks u very much Jeanne..good help to me..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic