updating a record at runtime using jdbc -


i have problem updating password @ runtime. gives no error doesn't work. please . in advance!

here code:

//here problem part not working

try {     system.out.println("id : "+j);     system.out.println("what want new password be?");     scanner s8=new scanner(system.in);     string s7=s8.nextline();     class.forname("com.mysql.jdbc.driver");     connection  con5=drivermanager.getconnection("jdbc:mysql://localhost:3306/login","root","q");     preparedstatement ps=con5.preparestatement("update pass set password=?     id=?");     ps.setstring(1,s7);     ps.setint(2,j); } catch(exception e) {     system.out.println(e); }     

you miss execution of statement using preparedstatement.executeupdate().
javadoc

executes sql statement in preparedstatement object, must sql data manipulation language (dml) statement, such insert, update or delete; or sql statement returns nothing, such ddl statement.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -