PostgreSQL
Note: Access to PostgreSQL is restricted to students with projects, and it can be accessed via special subnet (not available publicly to all students)
How to Access Your Database:
- First step, you need to request the creation of a database by sending an email to accounts@cs.uwindsor.ca
- Once CS IT confirms the DB creation, you can log in to https://psql.cs.uwindsor.ca
- If it’s your first time, click on “Add New Server”
- In the (Register – Server) windows:
Connect to PostgreSQL from console:
- Login/SSH to your project’s VM:
psql -h psql.cs.uwindsor.ca -U username -d db_name
Connect to a database from your application:
- When connecting to a database from your application, e.g:
<?php $pdo = new PDO( 'pgsql:host=psql.cs.uwindsor.ca;dbname=db_name, 'app_testuser', 'myPassword' ); $stmt = $pdo->query("SELECT current_user, current_database()"); print_r($stmt->fetch()); ?> - The password, must be provided in the code, we DO NOT recommend you use your UWIN username and password here
- Alternatively, create a custom username/role for the application. (as explained in the next steps)
Create New username/role for your application (Using the web interface):
- Login to https://psql.cs.uwindsor.ca
- Right click on "Login/Group Roles" and Create a new Role
- In the new windows, select the username (always start with app_):
- In the "Previliges" tab, you must enable "Can Login"
- In the "Membership" tab, add "app_users" (this step is to allow this new user to login remotely)
- Then, we need to grant this new user, access/privileges on your database. right click on your database, and select "Properties":
- Make sure you are the owner of the database (contact IT if you cannot change it)
- In the "Security" Tab, click on the plus (+) sign, to add the new user to the database:
Create New username/role for your application (Using the command prompt):












