Abdullah047

Update_SQL

Sep 2nd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package sqltest;
  7.  
  8. import java.sql.Connection;
  9. import java.sql.DriverManager;
  10. import java.sql.Statement;
  11. import java.sql.SQLException;
  12. import java.util.logging.Level;
  13. import java.util.logging.Logger;
  14.  
  15. /**
  16.  *
  17.  * @author Abdullah
  18.  */
  19. public class Update {
  20.     public static void main(String[] args){
  21.               try {
  22.         String URL="jdbc:mysql://localhost:3306/hawk?autoReconnect&useSSL=false";
  23.         String User="root";
  24.         String Password="abdullah";
  25.  
  26.             Connection con=DriverManager.getConnection(URL,User,Password);
  27.             Statement NS=con.createStatement();
  28.            NS.executeUpdate("UPDATE table1 SET NickName='Sharukh' WHERE ID=4 ");
  29.            
  30.            
  31.            
  32.        
  33.         } catch (SQLException ex) {
  34.          ex.printStackTrace();
  35.         }
  36.    
  37.    
  38.     }
  39. }
Add Comment
Please, Sign In to add comment