java - login unsuccessfull on clicking button? -


i have table:

create table user1(username varchar2(20) ,  first_name varchar2(20) ,  last_name varchar2(20) ,  password varchar2(20) ,  date_of_birth date ) 

following jdbc code::

if(e.getsource()==submit)         {         connection con=null;         resultset rs=null;         preparedstatement st=null;         try         {             class.forname("oracle.jdbc.oracledriver");              con=drivermanager.getconnection("jdbc:oracle:thin:@localhost:1522:xe", "hr", "hr");             st=con.preparestatement("select count(1) user1 username = ? , password = ? ");             //st.setparameter(1, text1.gettext());             //st.setparameter(2, p1.gettext());             st.setstring(1,text1.gettext());             st.setstring(2,text1.gettext());              rs= st.executequery();             //string t1=text1.gettext();             //string t2= p1.gettext();         while(rs.next())         {             if (rs.getint(1) == 1)                  {                  new rec_options();                 }         }         }         catch(sqlexception ee)         {         system.out.println(ee);         }         catch(exception e1)         {         system.out.println(e1);         }                 {         try         {          rs.close();          con.close();         st.close();         }         catch(sqlexception eee)         {         system.out.println(eee);         }         }         } 

is there problem in while loop ? cause after entering username , password when click on submit button ,another page "rec_options" should opened,but here nothing's happening nor getting error or in cmd.i'm entering correct username , password. please help!! thanks..

you've used "st.setstring(1,text1.gettext());" twice. think should change second 1 password string.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -