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

Method subscribe

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

Source from the content-addressed store, hash-verified

27 }
28
29 public void subscribe() {
30 try (Connection conn = connect()) {
31
32 Statement stmt = conn.createStatement();
33 stmt.execute("BEGIN");
34 stmt.execute("DECLARE c CURSOR FOR SUBSCRIBE my_view");
35 while (true) {
36 ResultSet rs = stmt.executeQuery("FETCH ALL c");
37 if(rs.next()) {
38 System.out.println(rs.getString(1) + " " + rs.getString(2) + " " + rs.getString(3));
39 }
40 }
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