hi,
public class UserNameValidator {
private Connection con= null;
private ResultSet resultSet = null;
try{
con = DriverManager.getConnection(url,"scott","tiger");
// Retrieve data from the database
Statement stmt = con.createStatement();
String sql = "SELECT username FROM userdetails WHERE (username='" +
req.getParameter("new_user_name")+ "')";
ResultSet rs = stmt.executeQuery(sql);
if(rs.next()!=null){
System.out.println("username already available");
}else{
/*
place the inser logic into database in this place
*/
}
----- Original Message -----
From: "K.M.Prabhu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 25, 2003 3:40 PM
Subject: How to write a validator class
> Dear All,
>
> I am having an application, in which i want to check whether the
> userName is existing in the database. For that want to write a
> validator for checking the userName. The userName value will be obtained
> from the database. How can I write a validator. Please anyone help me.
>
> Rgds,
> Prabhu
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]