import java.sql.*; public class Neo4jJdbcExample { public static void main(String[] args) { Connection connection = null; try { Class.forName("org.neo4j.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:neo4j:bolt://localhost", "neo4j", "password"); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("MATCH (n) RETURN n"); while (resultSet.next()) { System.out.println(resultSet.getString("n")); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } } } }