× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Database validation.
  • From: "McCallion, Martin" <MccalliM@xxxxxxxxxxxxxxxx>
  • Date: Thu, 15 Mar 2001 12:20:54 -0000

> We are working on an application which requires a validation 
> of the unique key at the database.But being relatively new to 
> both Java(Being used as the front end)and DB2 on AS400(The 
> database),we are facing some problems on the same.I just 
> wanted to know of any way by which the validations can be 
> done at the database level itself and not on the client side.
> That may be anything , from writing a servlet or to writing a 
> CL program on the AS400.
> It will be of great help to me and the application on getting 
> the solution.
> Hoping for a quick solution.
> Saurabh Ganguly

If I understand your question correctly, then it's quite easy.  You just
need to specify your keys as unique when creating your files.  If your
files are created using DDS, you use the UNIQUE keyword; if they are
created using SQL then there's a way too, but I don't know what it is.

This will just ensure that keys are unique: that is, if you try to write
a record that has the same key as a record that is already on the file,
the database manager will generate an error.  If you need something more
complex than that, then you probably want to look into database
triggers.

HTH.

Cheers,

Martin.
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.