-->
PostgreSQL

PostgreSQL

How to use PostgreSQL

The department offers a PostgreSQL database account to anyone who has a computer science account for use with class related projects or their own personal projects. The database may be accessed via a command line application (psql) or through student created applications. The department does not automatically create a database account for everyone; instead each student must request a database account. This how-to describes how to request a database account and how to connect to the database via a command line application. This how-to does not describe how to connect your application to the database for information on how to do this consult the documentation for your platform (php, java, asp, .net, etc.) or your TA / Instructor.

How to request a database account

  1. User your preferred web browser to go to http://csnet.cs.tamu.edu/
    Note, you must either be on campus or using VPN to access this site.

  2. Log in by entering your CS username and web password.
    If you have forgotten your password or need assistance in logging please visit the helpdesk in room 210.

  3. Click on the "Helpdesk" tab.

  4. Click on the "Submit Request" link on the left bar in the section labelled "Task Requests".

  5. Enter "Database Account Request" as the subject.

  6. Enter "I am requesting a PostgreSQL database account." as the task description.

  7. For type select "Account related".

  8. Click submit.

After submitting the request it will take a day or two for it to be processed. Once it is processed you initial database password will be set to your student ID number.

Connecting to PostgresSQL

There are several ways to connect to the PostgreSQL database. You may connect via a command line application which allows you to directly enter SQL queries or have your application connect to the database.

  1. Use an SSH client such as PuTTY, login to unix.cs.tamu.edu.

  2. At the command prompt run the psql command as follows:
    > psql -h database.cs.tamu.edu

  3. Enter your database password at the prompt.
    Welcome to psql 7.4.1, the PostgreSQL interactive terminal.

    Type:  \copyright for distribution terms
           \h for help with SQL commands
           \? for help on internal slash commands
           \g or terminate with semicolon to execute query
           \q to quit
    <your username>=>

    From this prompt you may enter SQL queries to access the database. Remember to quit psql use the \q command.

Changing your database password

Once you get your database account activated, one of the first things you will want to do is change the initial password to something more secure. To change your password first login as described above, and enter the following SQL query.

  ALTER USER username WITH PASSWORD 'new_password';

An example of this would be "ALTER USER vkj6393 WITH PASSWORD 'a4tgk3c';"

If you forget your password or have any problem changing it, visit the helpdesk in room 210 for assistance.

Additional Resources

For more information on how to use psql, the features of PostgreSQL, or general information about SQL visit these website.


To Top of Page To Top Of Page Printer Friendly Version

©CSG Helpdesk

Valid CSS!