Answers for "how to delete from sql table from java"

1

statement delete sql java

public static void DeleteRow(String name) {
    try {  
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection(url, username, password);
        PreparedStatement st = connection.prepareStatement("DELETE FROM Table WHERE name = ?");
        st.setString(1,name);
        st.executeUpdate(); 
    } catch(Exception e) {
        System.out.println(e);
    }
}
Posted by: Guest on February-04-2021

Code answers related to "how to delete from sql table from java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language