Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Data validation before adding to database

952837Jul 30 2012 — edited Jul 31 2012
I am new to Java and we are trying to validate large amount of data before the data can be inserted into the database.
We want to make sure that the data is in the format that we expect - like types(int, string etc), Length, no of times the data occurs, mandatory fields etc.

Ideally we would like to create a schema and define the rules there. As and when the data arrives, we would like to validate the data against the schema.
What is the best way to achieve this in Java. Below is a simple example

class DataTobeValidated
{
private String Name;
private int SSN;
private String Address;
private String Phone no;

public void InsertDataIntoDatabase()
{
// Insert Data Into Database after Validating the Data.
ValidateData();
.........
}
public void ValidateData()
{
// Validate the data using schema.
}
}

I need to implement ValidateData() using minimal efforts (using some form of schema). Validating using Schema may help since I can change the rules in Schema without having to compile the code.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 28 2012
Added on Jul 30 2012
1 comment
666 views