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

Class App

connection-examples/java/connection.java:6–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import java.util.Properties;
5
6public class App {
7
8 private final String url = "jdbc:postgresql://MATERIALIZE_HOST:6875/materialize";
9 private final String user = "MATERIALIZE_USERNAME";
10 private final String password = "MATERIALIZE_PASSWORD";
11
12 /**
13 * Connect to Materialize
14 *
15 * @return a Connection object
16 */
17 public Connection connect() {
18 Properties props = new Properties();
19 props.setProperty("user", user);
20 props.setProperty("password", password);
21 props.setProperty("ssl","true");
22 Connection conn = null;
23 try {
24 conn = DriverManager.getConnection(url, props);
25 System.out.println("Connected to Materialize successfully!");
26 } catch (SQLException e) {
27 System.out.println(e.getMessage());
28 }
29
30 return conn;
31 }
32
33 public static void main(String[] args) {
34 App app = new App();
35 app.connect();
36 }
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected