b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
user=tf1.getText();
pass=new String(tf2.getPassword());
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","jashan","noor1032");
PreparedStatement stmt=con.prepareStatement("select * from jashan.student where 'name1'=? and 'password'=?");
stmt.setString(1, user);
stmt.setString(2, pass);
ResultSet Rs=stmt.executeQuery();
if(Rs.next())
{
JOptionPane.showMessageDialog(f, "success!!");
}
else
{
JOptionPane.showMessageDialog(null, "incorrect username/password","warning",JOptionPane.WARNING_MESSAGE);
}
}
catch(Exception f)
{
System.out.println(f);
}
}
actually, i want that the code matches the username and password, but it is not doing so...whenever i execute, it shows invalid password/username....i don't know why....i have a table in oracle 11g which has columns student_id, name1,gender,address, email_id, phone_number,and password in the same order as defined. can anyone tell me what is the problem??