White dot for spacing only
The Dice Project


postgresql.html,v 1.23 2008/09/30 12:13:17 gdutton Exp

PostgreSQL User Self-Service Guide

How do I get a PostgreSQL account / database?

You will need to be logged into the DICE public ssh server, ssh.inf.

From a regular DICE PC, you can connect to this machine by typing

ssh ssh

at a terminal.

Once connected, simply run:

pg-selfservice

You will be asked to confirm, and then asked to set a password for your account. Remember that this password is for non-interactive scripted access only; you will not be asked for this during normal database interaction.

Confirm the details above, and your account and database will be created. That's it! Your account is immediately active.

Self-service says I'm not permitted to register, but I should have an account.

First, check the error carefully, and ensure that you have not already been given an account (try connecting to the database server as shown below).

Ensure you have filled out your course registration form (if applicable) correctly, and note that there can be a delay of 24 hours (or more at weekends) between submitting a form and receiving self-service access.

If you have been refused an account, but believe you should be entitled to a database, contact support, giving as much detail about your proposed database usage as possible.

How do I access my database?

From any DICE machine (but remember to log out of your chosen remote server, first), simply type the following:

psql -h pgteach

You will be connected to your database on the database server.

If you are not on a DICE machine, the only recommended connection method is to use SSH to connect into DICE, then to use psql from within.

I tried typing psql, but got an error

While attempting to connect to your database you may receive the following error:

psql: krb5_sendauth: Ticket expired

This is most likely because you have been logged in for a long time, or perhaps left your computer locked overnight. The solution is simply to issue the following command at a terminal:

renc

You will be prompted for your DICE password.

A similar error can be found if you clear out the contents of /tmp on your machine:

psql: pg_krb5_init: krb5_cc_get_principal: No credentials cache found

This can be avoided by not deleting files named /tmp/krb5cc_*, and is solved by the renc procedure described above.

If you have any other problems, feel free to contact support. Copy or write the error message into the form if possible.

How do I use my database with scripts?

Your regular database access is granted using Kerberos; this means that, while using PSQL, you will not need to enter your password to access databases. Non-interactive Kerberos authentication is not supported for this service. For this reason you also have the ability to set a password for scripting purposes.

If you have not set a password, your account will have have none. This denies all password attempts. To create a password, follow the instructions for resetting your password below.

Why is my script's SSL connection breaking?

Sorry, but at present, SSL is only supported over interactive psql sessions. You will have to use a regular, unsecured connection, unless you are on a known DICE web server.

Exceptions have been made for a number of web servers, including homepages.inf, so that both SSL and non-SSL connections will work.

You can force PHP not to use SSL with by adding "sslmode=disable" to your list of pg_connect options, i.e.:

$dbconn = pg_connect ("host=$server dbname=$db user=$username password=$password sslmode=disable")

(Thanks to neilb for the tip)

If you are using the interactive psql client in a script, setting the $PGSSLMODE environment variable to 'disable' before running psql will have a similar effect.

I left my scripting password on a post-it note in a lab. How can I change it?

Note your password is your responsibility, and should be secret. Don't write it down.

Most users can change their own passwords in postgres. (note the quotes in the commands below; they are important)

Alternatively you can use the pg-selfservice script to reset your password, as if you were creating a new account.

I've forgotten my password, and lost the post-it note. How can I reset it?

Your password is not stored in accessible form anywere, but you don't need to know your password to change it. Simply reset it as above.

I'm still stuck. How can I get help?

Please visit the Informatics support form. Ensure you have read all relevant FAQs before continuing.


 : Units : Research_and_teaching : Documentation 

Mini Informatics Logo - Link to Main Informatics Page
Please contact us with any comments or corrections.
Unless explicitly stated otherwise, all material is copyright The University of Edinburgh
Spacing Line