Basic Database Installation Instructions

Description

  • Basic instructions that were needed before the python script

Database Initialization

  1. Open pgAdminIII.
    1. For Windows, go to Start–>All Programs–>Postgres Plus 8.3–>Developer & Client Tools–>pgAdminIII and enter your password if it asks.

    2. For Kubuntu Linux, go to All Applications–>Postgres Plus 8.3–>Developer/Client Tools–>pgAdminIII

  2. If you see a server named something like “Postgre Plus 8.3 (localhost)” in the Object Browser, continue to the next step. Otherwise, you need to add the server you just installed. Click on Servers in the Object Browser and go to File–>Add Server. In the New Server Registration form, type in Postgre Plus 8.3 as the server name, localhost as the host, and the user-name and password for your database superuser. If PostGreSQL was installed with a port other than 5432, enter it in as well. Then click OK.

  3. Double-click on PostGreSQL Database Server 8.3 (localhost), click on Login Roles, and go to Edit-->New Object-->New Login Role.... We will now create the user that Continuity logs in as when it Queries your database. Such a user should have no privileges for security reasons. Copy and paste continuity user as the user name and enter a password. Then make sure none of the buttons are checked under Role Privileges and click OK.

  4. To actually construct the database, click on Databases and go to Edit-->New Object-->New Database....

    1. Enter ‘continuity’ as the database name.
    2. Select ‘continuity user’ as the Owner
    3. Go to the Privileges Tab, select the ‘All’ radio button, select ‘public’ from the drop-down menu, and click ‘Add/Change’. Make sure User/Group ‘public’ with privileges ‘CTc’ is visible in the table. Then click OK.
    4. All the necessary settings should be stored so only “continuity user” and the superuser can access this database.
  5. After the database is created, click on ‘continuity’ under Databases and go to Tools-->Query tool.

    1. Before continuing you must download the following SQL script that will create the database structure: (continuity_db_structure3.sql)

  6. In the Query Editor, go to File-->Open and open the continuity_db_structure3.sql script file you just downloaded. Then go to Query-->Execute.

    1. You should see something like “Query returned successfully with no result in 267 ms” in the messages output pane. If you receive some sort of error (not a warning) try re-building login role “continuity user” and database “continuity”. You can do this by selecting each object, going to Edit–>Delete/Drop, and carefully following the above instructions to construct each object.

  7. If PostGreSQL was installed on the same machine you run continuity on, you can skip ahead to Configure Database Profile. If you need remote access to the database via TCP/IP connections, continue to Setting Up Remote Connections.

Setting Up Remote Connections

  1. You need to edit pg_hba.conf and postgresql.conf. This can be done from the command line (in Installation of PostGreSQL-8.3.3 on Other Platforms above) or by using pgAdminIII.

  2. Open pgAdminIII and select your server (should be something like ‘Postgres Plus 8.3 (localhost:5432)’).
  3. Go to File-->Open pg_hba.conf. It should be in your ‘data’ directory, which is probably in a folder labeled ‘PostgresPlus‘ or ‘Postgre SQL 8.3’ on your hard disk.

  4. After opening, double-click on an empty row and enter in the following values: set TYPE to <host>, DATABASE to <continuity>, USER to <continuity user>, CIDR-ADDRESS to <0.0.0.0/0>, and METHOD to <trust>. Make sure the configuration is enabled, click OK, and save the file.

  5. After exiting the editor go to File-->Open postgresql.conf. It should be in the same folder as pg_hba.conf. Make sure the setting labeled ‘listen_addresses’ is checked and make sure its value is ‘*’. If you make any changes save the file and exit the editor.

  6. For the new configuration to take effect you must now restart the server. In your Applications Menu, go to Postgres Plus 8.3-->Database Server-->Reload Configuration

  7. Server setup is now complete and you can continue to Configure Database Profile.

Configure Database Profile

  1. To access your database from Continuity you need to store the new connection profile as the default setting.
  2. Open Continuity and go to File-->Library-->Connect...

  3. Click on the Use Custom Library radio button at the top and enter in your server and database information. Host Server should be localhost if you installed PostGreSQL on your local machine, Database Name should be continuity (or whatever you named it), and User Name should definitely be continuity user.

  4. Click on the Test Connection button at the bottom. If the connection is successful you should save the profile somewhere outside of your Continuity Directory (so it does not get deleted if you re-install Continuity) before clicking OK. If you get an error:

    1. "could not translate host name..." – Check your Host Name. Again, it should be localhost if you are on the same machine the server is running on. Otherwise it should be your valid server address (something like “server.ucsd.edu”).

    2. "database 'continuity' does not exist..." – Make sure you followed the instructions in Database Initialization and you named your database ‘continuity’ (case sensitive).

    3. "password identification failed for user "continuity user" – Check your user-name and password (case sensitive). The user-name continuity user should exist on your server and be entered in to the connection form and its password should match up as well.

    4. "could not connect to server: connection refused ... is the server running on host and accepting TCP/IP Connections ...?" – If you are on localhost, check your port number. Also make sure the database is running by going to Postgres Plus 8.3-->Database Server-->Start Service in your Applications Menu or running <./pg_ctl -D <PATH>/pgsql/data start> from the command line in your bin directory. If you are connecting to a remote server, make your you followed the directions in Setting Up Remote Connections (did you restart the server?).

    5. "relation model does not exist..." – Make sure you ran the script in Database Initialization and it was successful.

    6. "permission denied for relation model..." – This means the database is up and running but the privileges aren’t set right for the database. Try re-building the user role “continuity user” and the database “continuity” as specified in Database Initialization.

  5. You should now be able to store and retrieve models from your database.