Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package sqltest;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.Statement;
- import java.sql.SQLException;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- /**
- *
- * @author Abdullah
- */
- public class Update {
- public static void main(String[] args){
- try {
- String URL="jdbc:mysql://localhost:3306/hawk?autoReconnect&useSSL=false";
- String User="root";
- String Password="abdullah";
- Connection con=DriverManager.getConnection(URL,User,Password);
- Statement NS=con.createStatement();
- NS.executeUpdate("UPDATE table1 SET NickName='Sharukh' WHERE ID=4 ");
- } catch (SQLException ex) {
- ex.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment