import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.SQLException;
public class delete {
public static void main(String[] args) throws Exception
{
Connection connection = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost/pinnacle";
String user = "root";
String password = "admin";
connection = DriverManager.getConnection("jdbc:mysql://localhost/pinnacle",
"root", "admin");
Statement stmt = connection.createStatement();
String sq1 = "DELETE FROM pinnacle WHERE course= 'java'";
stmt.execute(sq1);
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
if (connection != null)
{
connection.close();
}
}
}
}
No comments:
Post a Comment