Java tutorial
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class Main { public static void main(String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/book", "root", ""); PreparedStatement ps = connection.prepareStatement("UPDATE books SET title = ? WHERE id = ?"); ps.setString(1, "Java"); ps.setInt(2, 1); int rows = ps.executeUpdate(); System.out.printf("%d row(s) updated!", rows); connection.close(); } }