Java tutorial
import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; public class Main { static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost/STUDENTS"; static final String USER = "username"; static final String PASS = "password"; public static void main(String[] args) throws Exception { Connection conn = null; Statement stmt = null; Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Deleting database..."); stmt = conn.createStatement(); conn = DriverManager.getConnection(DB_URL, USER, PASS); stmt = conn.createStatement(); String sql = "INSERT INTO Person VALUES (1, 'A', 'B', 18)"; stmt.executeUpdate(sql); sql = "INSERT INTO Person VALUES (2, 'C', 'D', 25)"; stmt.executeUpdate(sql); sql = "INSERT INTO Person VALUES (3, 'E', 'F', 30)"; stmt.executeUpdate(sql); sql = "INSERT INTO Person VALUES(4, 'S', 'M', 28)"; stmt.executeUpdate(sql); stmt.close(); conn.close(); } }