#!/usr/bin/env python # coding: utf-8 # ## Print out misc. info about the system, and test the connection to the Neo4j database # You will be prompted for your database credentials # In[1]: import set_path # Importing this module will add the project's home directory to sys.path # In[2]: import os import sys import getpass from neoaccess import NeoAccess # In[3]: print("*** SOME DIAGNOSTIC VALUES: ***") print("\nsys.executable: ", sys.executable) print("\ncwd: ", os.getcwd()) #print("\nsys.path: ", sys.path) print("\nsys.path using separate lines: ") for p in sys.path: print(" ", p) # # Connect to the database # #### You can use a free local install of the Neo4j database, or a remote one on a virtual machine under your control, or a hosted solution, or simply the FREE "Sandbox" : [instructions here](https://julianspolymathexplorations.blogspot.com/2023/03/neo4j-sandbox-tutorial-cypher.html) # NOTE: This tutorial is tested on version 4 of the Neo4j database, but will probably also work on the new version 5# Connect to the database # In[4]: # Save your credentials here - or use the prompts given by the next cell host = "" # EXAMPLES: bolt://123.456.789.012 OR neo4j://localhost password = "" # In[5]: print("To create a database connection, enter the host IP, but leave out the port number: (EXAMPLES: bolt://123.456.789.012 OR neo4j://localhost )\n") host = input("Enter host IP WITHOUT the port number. EXAMPLE: bolt://123.456.789.012 ") host += ":7687" # EXAMPLE of host value: "bolt://123.456.789.012:7687" password = getpass.getpass("Enter the database password:") print(f"\n=> Will be using: host='{host}', username='neo4j', password=**********") # In[6]: db = NeoAccess(host=host, credentials=("neo4j", password), debug=False) # Notice the debug option being OFF # In[7]: print("Version of the Neo4j driver: ", db.version()) # In[ ]: