public void close() if (dataSource != null && !dataSource.isClosed()) dataSource.close();
// Store JSON PGobject jsonObj = new PGobject(); jsonObj.setType("json"); jsonObj.setValue("\"key\": \"value\""); pstmt.setObject(1, jsonObj); // Read JSON String jsonStr = rs.getString("data"); postgres jdbc driver
// Store array Integer[] intArray = 1, 2, 3; Array array = conn.createArrayOf("integer", intArray); pstmt.setArray(1, array); // Read array Array resultArray = rs.getArray("int_array"); Integer[] values = (Integer[]) resultArray.getArray(); public void close() if (dataSource
Class.forName("org.postgresql.Driver"); // not required in modern Java Array array = conn.createArrayOf("integer"
Load driver (automatic since JDBC 4+):
JSON/JSONB: