This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes deleting from database(simple) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "deleting from database(simple)" Watch "deleting from database(simple)" New topic
Author

deleting from database(simple)

Murasoli Maran
Ranch Hand

Joined: Jun 08, 2003
Posts: 193
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

Joined: Jan 10, 2002
Posts: 60774
    
  65

This hasn't much to do with JSP per se, so I'm moving it along to the JDBC forum.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Murasoli Maran
Ranch Hand

Joined: Jun 08, 2003
Posts: 193
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

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

Joined: Jun 08, 2003
Posts: 193
Thanks u very much Jeanne..good help to me..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deleting from database(simple)
 
Similar Threads
interview question
Help with my graduation project
Is there some trick to prevent decompilers from seeing my password?
JAAS Security Policy File
Enthuware doubt : Buisness Delegate