Steps for setting up Control with a SQL backend

  1. Create a regular company, or use an existing one. Once you complete the SQL conversion process you cannot go back
  2. Edit the file /etc/odbc.ini with the following information:

    [FAYEZ]
    # This is the implementation specific driver for the database. 
    # Different databases (mysql, oracle) would have different drivers
    Driver     = /usr/local/lib/psqlodbcw.so
    Port       = 5432
    ServerName = localhost
    # Ensure that the database name is lowercase. 
    # The name does not have to correspond to the company name
    Database   = fayez 
    # This username should have already been created.
    UserName   = ccc
    # Leave this blank if you want to be prompted for a password
    Password   =
  3. Log into the database with a user who can create new databases and specify owners (an admin user, such as postgres), and create the database specified in step 2.

    -bash-3.00$ su -postgres
    -bash-3.00$ psql 
    Password: 
    Welcome to psql 8.1.3, the PostgreSQL interactive terminal.
    postgres=# create database fayez with owner = ccc;
    CREATE DATABASE
  4. Run coaad and select the company. Goto the second page, and set the option Use SQL backend? to YES

  5. Change into the SQL environment and then run createccdb to create the required tables and sequences. Other options are available to createdb, you can view these by using the --help option.

    [:X11:DEV]/home/usr/fayez/mod/work.!> gosql
    [:X11:DEV:sql]/home/usr/fayez/mod/work.!> createccdb 
    
    Create tables: All, drop existant tables: No, Company code: FAYEZ, Company name: DEMONSTRATION CO.
    
    Do you want to proceed (yes/no)?
    yes
    
    create tables [All] successfull, see log for detail
  6. Change to the company directory and create a new directory for the datafiles. All successfully converted files will be moved to this directory. You should also move the index files there. This is not nesscarry but is useful if you need to rollback, or if the import fails. Run importccdb to import all the data into the database. This will take a while if you have a large amount of data.

    [:X11:DEV:sql]/home/usr/fayez/mod/work.!> cd /ccdev/FAYEZ
    [:X11:DEV:sql]/ccdev/FAYEZ.!> mkdir backup
    [:X11:DEV:sql]/ccdev/FAYEZ.!> cp *.idx backup/
    [:X11:DEV:sql]/ccdev/FAYEZ.!> importccdb -m backup 
    Import file = All,  Move processed files = Yes,  directory: /u/ccdev//FAYEZ/backup
    Company code: FAYEZ, Company name: DEMONSTRATION CO.
    
    Do you want to proceed (yes/no)?
    yes
    
    import tables [All] successfull, see log for detail
  7. To manually log into to the databases, you can do the following. The password is usually support.
    -bash-3.00$ psql -U ccc fayez
    Password for user ccc: 
    Welcome to psql 8.1.3, the PostgreSQL interactive terminal.
    
    Type:  \copyright for distribution terms
           \h for help with SQL commands
           \? for help with psql commands
           \g or terminate with semicolon to execute query
           \q to quit
    
    fayez=> 
  8. updateccdd should be run everytime a new field is introduced to a structure or one is moved or removed. It is probably safer to run this everytime new programs are compiled or copied across to customer sites. It is very quick and requires no user interaction.


CategorySql