import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class Main {
public static void main(String[] argv) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbctutorial",
"root", "root");
String sql = "INSERT myTable VALUES(?,?,?,?)";
PreparedStatement prest = con.prepareStatement(sql);
prest.setString(1, "A");
prest.setInt(2, 5);
prest.setDouble(3, 2.0);
prest.setFloat(4, 4.2f);
int row = prest.executeUpdate();
System.out.println(row + " row(s) affected)");
}
}