How To Setup Your Own Library

Description

  • You must install PostGreSQL-8.3.3 with XML Library support on your machine and run the provided script to create the database structure.
  • If you have a version of PostGreSQL older than 8.3, which do not have XML support, or you already have it installed but without the XML Library, you must update with the XML library (XML 2 module in contrib modules or <./configure --with-libxml> if you are building from source).

  • Refer to http://www.postgresql.org/docs/8.3/static/index.html for additional support on installing PostGreSQL 8.3.

Installation of PostGreSQL-8.3.3 on Windows/Linux/Mac

  1. Go to http://www.enterprisedb.com/products/pgdownload.do and download the package for your operating system.

  2. Unpack and execute the postgres-plus-8.3 installer package.

    1. For Linux:
      1. Open a command-line terminal and cd to the directory where you downloaded the package.
      2. run <tar -xvzf pgplus-833-2-linux-x32.tar.gz> to unzip and unpack (for the 32-bit package).

      3. run <chmod +x pgplus-833-2-linux-x32> to give yourself permission.

      4. go into that directory <cd pgplus-833-2-linux-x32> , and run <./postgreplus_x86-32.bin> to execute the binary.

      5. If the installer says you need administrative privileges, try running <sudo ./postgreplus_x86-32.bin> if you are a sudo user and enter your password. Otherwise, you need to switch users to a user with administrative privileges.

    2. For Windows:
      1. After downloading the .zip, right-click on the file and select Extract All...

      2. Open the file pgplus-833-2-win and double-click on the postgres-plus-8.3 installer package.

  3. Run through the installer.
    1. At Installation Options, make sure at least Postgres Plus, Database Server, and Developer/Client Tools are installed.
    2. At Service Configuration, you will have to enter and verify a password for the superuser that will run PostGreSQL. If you already have a user account on your system, you can just enter the same user-name and/or password. If you choose to make a new account, set Account Domain to your system account user-name.
    3. At Initialize Database Cluster, you can enter the same user-name and password for your database superuser and make sure the Encoding Server is UTF8. Save this information.
  4. After completing installation, you can continue to Database Initialization.

Installation of PostGreSQL-8.3.3 on Other Platforms

  1. If there are no binaries available for your operating system, refer to http://www.postgresql.org/docs/8.3/interactive/installation.html for instructions on installing from source code. Just make sure you run <./configure --with-libxml> during installation. Your system probably doesn't support pgAdminIII either, so here are some instructions on how to initialize the database on Unix/Linux based systems from command line:

  2. After installing and switching user to the superuser (named 'postgres' in the tutorial), initializing the database, and starting the database, run <./psql> to enter the postgreSQL interactive terminal.

  3. To create the database, run <CREATE DATABASE continuity ENCODING = 'UTF8';>, then <REVOKE ALL ON TABLE owners, model, class_model_intermediate, class, object_class_intermediate, object, data, attribute FROM PUBLIC;>. Then enter <\q> to quit.

  4. After obtaining the script (continuity_db8.sql), run <psql -d continuity -f <PATH>/continuity_db7.sql> to setup the database.

  5. To create the unprivileged role, run <CREATE ROLE "<user>" LOGIN ENCRYPTED PASSWORD '<password>' NOSUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;> with your own user name and password. Then run the following commands:

    1. GRANT CONNECT ON DATABASE continuity TO "<user>";

    2. GRANT USAGE ON SCHEMA public TO "<user>";

    3. REVOKE ALL ON TABLE owners, model, class_model_intermediate, class, object_class_intermediate, object, data, attribute FROM "<user>";

  6. To setup Remote Connections, go into your data directory (<cd ../data> should work) and edit pg_hba.conf and postgresql.conf as follows:

    1. In pg_hba.conf towards the bottom where the last few lines are uncommented, add a new configuration similar to the ones already present except set TYPE to <host>, DATABASE to <continuity>, USER to <continuity user>, CIDR-ADDRESS to <0.0.0.0/0>, and METHOD to <md5>. Save your changes and quit.

    2. In postgresql.conf under CONNECTIONS AND AUTHENTICATION, set <listen_addresses = '*'> and uncomment that line by removing the '#'. Save your changes and quit.

  7. You must now restart the server for the above changes to take effect. Go back to the bin directory <cd ../bin> and as the superuser run <./pg_ctl -D <PATH>/pgsql/data restart>. The database should now be up and running.

Database Initialization

  1. Download and run the script for the following package for your platform. NOTE: The Macintosh package will only work on your system if it has Continuity installed.
    1. For Windows: (Continuity_DB_Init_Windows3.zip)

      1. After downloading the .zip, right-click on the file and select Extract Files...

      2. Open the file Continuity_DB_Init_Windows and double-click on the InitializeDBScript script installer.

    2. For Linux: (Continuity_DB_Init_Linux3.tar.gz)

      1. Open a command-line terminal and cd to the directory where you downloaded the package.
      2. run <tar -xvzf Continuity_DB_Init_Linux.tar.gz> to unzip and unpack.

      3. run <chmod +x Continuity_DB_Init_Linux> to give yourself permission.

      4. go into that directory <cd Continuity_DB_Init_Linux> , and run <python InitializeDBScript.py> to execute the script.

    3. For Mac: (Continuity_DB_Init_Mac3.tar.gz)

      1. Open a command-line terminal and cd to the directory where you downloaded the package.
      2. run <tar -xvzf Continuity_DB_Init_Linux.tar.gz> to unzip and unpack.

      3. go into that directory <cd Continuity_DB_Init_Linux>

      4. You will need to run the InitializeDBScript.py program with Continuity's version of python (called mglpython, which is in Continuity's home folder. To do this:

        1. Find the path to Continuity's home folder by running find / -name mglpython. There should only be one result with a path mentioning Continuity.

        2. From the Continuity_DB_Init_Linux directory, run <<path>/mglpython InitializeDBScript.py> with the path you found in the previous step. For example, if the path to my mglpython is '/Users/aguthals/cont_dev/mglpython', I would run '/Users/aguthals/cont_dev/mglpython InitializeDBScript.py'.

  2. Run through the script by selecting menu option '1'.
  3. It will ask you for your port, superuser user-name, and password (you were supposed to save this from step 3.2 in 'Installation of PostGreSQL-8.3.3 on Windows/Linux/Mac').
  4. It will ask you for a name of the new database.
  5. It will ask you for a new user-name and password. This will be for the user Continuity will log in as when it accesses your database.
  6. It is then recommended that you save the profile in your home directory. If you choose not to do this you will have to create a new profile from Continuity's Connection Form.
  7. After the database is created, you can configure remote connections. Doing this will allow anyone with your new user-name, password, database name, host server, and port to access your database.

Configure Database Profile

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

  3. If you already saved a profile from the script above, click 'Open', find your saved profile, open it, and click 'OK'. If no errors come up you can now access your database and installation is complete. Continue if you did not save a profile.
  4. 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.

  5. 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.

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