MCPcopy Create free account
hub / github.com/MaterializeInc/demos / insert

Method insert

connection-examples/java/insert.java:30–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28 }
29
30 public void insert() {
31
32 try (Connection conn = connect()) {
33 String code = "GH";
34 String name = "Ghana";
35 PreparedStatement st = conn.prepareStatement("INSERT INTO countries(code, name) VALUES(?, ?)");
36 st.setString(1, code);
37 st.setString(2, name);
38 int rowsDeleted = st.executeUpdate();
39 System.out.println(rowsDeleted + " rows inserted.");
40 st.close();
41 } catch (SQLException ex) {
42 System.out.println(ex.getMessage());
43 }
44 }
45
46 public static void main(String[] args) {
47 App app = new App();

Callers 1

mainMethod · 0.95

Calls 1

connectMethod · 0.95

Tested by

no test coverage detected