BPI Oxford

UTSE PostgreSQL Server

๐Ÿ—„๏ธ
Database Admin
pgAdmin 4
Web interface โ€” login required
๐Ÿ“–
Documentation
GitHub Docs
Setup guides & user management

New Users โ€” Getting Started

  1. Request database credentials from your administrator (host, port, database name, username, password).
  2. Choose how to connect โ€” use pgAdmin below for a GUI, or Python for scripting and data analysis.
  3. Read the full New User Getting Started Guide for detailed instructions and troubleshooting.

Connecting to the Database

  1. Open pgAdmin 4 in your browser and log in with your credentials.
    Or install the pgAdmin desktop app on your own machine โ€” same steps apply.
  2. Right-click Servers in the left panel โ†’ Register โ†’ Server.
  3. Fill in the Connection tab:
    Host: vcloud229.it.ox.ac.uk
    Port: 5432
    Database: <your_database>
    Username: <your_username>
    Password: <your_password>
  4. Under the SSL tab set SSL mode to Require.
  5. Click Save. Your databases will appear in the left panel.
  1. Install the required library:
    # in your terminal or conda environment
    pip install psycopg2-binary
  2. Store credentials in environment variables โ€” never hard-code passwords:
    # add to ~/.bashrc, ~/.zshrc, or a .env file
    export PG_HOST=vcloud229.it.ox.ac.uk
    export PG_PORT=5432
    export PG_DB=your_database
    export PG_USER=your_username
    export PG_PASS=your_password
  3. Connect and query:
    import psycopg2, os

    conn = psycopg2.connect(
        host=os.environ["PG_HOST"],
        port=os.environ["PG_PORT"],
        dbname=os.environ["PG_DB"],
        user=os.environ["PG_USER"],
        password=os.environ["PG_PASS"],
        sslmode="require"  # always encrypt in transit
    )

    with conn.cursor() as cur:
        cur.execute("SELECT * FROM my_table LIMIT 5;")
        for row in cur.fetchall():
            print(row)

    conn.close()
  4. For pandas / data analysis:
    import pandas as pd, os
    from sqlalchemy import create_engine

    # pip install sqlalchemy psycopg2-binary
    url = (
        f"postgresql+psycopg2://{os.environ['PG_USER']}:{os.environ['PG_PASS']}"
        f"@{os.environ['PG_HOST']}:{os.environ['PG_PORT']}/{os.environ['PG_DB']}"
        "?sslmode=require"
    )
    engine = create_engine(url)

    df = pd.read_sql("SELECT * FROM my_table LIMIT 100", engine)
Security reminders: Always use sslmode="require" to encrypt data in transit. Never commit passwords to git โ€” use environment variables or a .env file and add it to .gitignore.

Administrators โ€” Documentation