Setting Up the Historical Database

Set up Sybase IQ as the historical database in RAP.

Some of the installation steps require that you use dbisqlc. After running a dbisqlc command, an error message displays stating “Invalid user ID or password.” Click OK, then in the next window, fill in the password for the user specified, and select OK to run the script. This is necessary to prevent passing your password on the command line since this is undesirable for security reasons.

Do not use spaces in the installation directories for any of the RAP components.

  1. Open a new command prompt. Do not reuse a command prompt from the installation of another RAP component.
  2. Install Sybase IQ 15.4 ESD#1 or higher.
    The installer may display additional options other than the options below but the suggestions detailed in this step are important when configuring Sybase IQ for RAP. If no suggestion is made for an option, you can accept a default value or see the Sybase IQ Installation Guide for additional information.
    1. Choose a typical installation.
    2. When prompted, install a licensed copy of the server but select the option that allows you to continue the installation without a license key because the RAP license will not be accepted until further steps are performed. Or if you already have a licensed server set up, choose the licensed server.
    3. Select Enterprise Edition for the product edition, and select the license type corresponding to your RAP license.
    4. Install all RAP components on separate machines. If other Sybase components exist on this machine, ensure that the RMI port specified in the installer is unique from the RMI ports specified for other Sybase components. The default for all Sybase components is 9999.
    5. Change the Sybase Control Center password for the uafadmin user if the installer you are using gives you this option. Otherwise, follow the instructions in the Setting Passwords or Disabling Default Login Accounts topic in the Sybase Control Center 3.2.7 Installation Guide to change the password for this user once you have completed your installation.

      The SCC portion of this installer installs the agent that communicates with SCC. The actual SCC server is installed using the Sybase Control Center installer.

    6. When asked whether you wish to start a Sybase Control Center Server, decline.
  3. Copy the RAP enablement package to the Sybase IQ server machine, and extract it into a directory of your choice.
    If any of the RAP components from this current RAP version are installed on this machine, you can use the existing RAP enablement installation. This is referred to as the RAP enablement installation directory throughout the rest of this guide.
  4. If you did not run it previously, run the configure.sh shell script from the RAP enablement installation directory.
    This file prepares the Sybase IQ script files for execution.
  5. Source the SYBASE.sh or SYBASE.csh script file located in the RAP enablement installation directory.
  6. To be able to use the Sybase IQ utilities required for setting up the database, source the IQ.sh or IQ.csh files in <Sybase IQ Install Directory> .
  7. Create the RAP database for your Sybase IQ server. If you set up your in-memory database to support multibyte characters, set up the historical database to also support multibyte characters. Note that some of the commands below have line spacing added for the sake of clarity, and that you should remove these line spaces before running the commands.
    1. If your in-memory database was set up to support multibyte characters, create a multibyte enabled database. Create a directory to store your database files if it does not already exist. Then, replace the three <Sybase IQ Database Location> placeholders with this location, and run the command:
      dbisqlc -c "uid=dba;eng=myserver;dbn=utility_db" 
      "CREATE DATABASE '<Sybase IQ Database Location>/RAPIQ' 
      IQ SIZE 500 
      COLLATION 'UTF8BIN'
       IQ PATH '<Sybase IQ Database Location>/RAPIQ.iq' 
      TEMPORARY PATH '<Sybase IQ Database Location>/RAPIQ.iqtmp' 
      TEMPORARY SIZE 1000;"
    2. Otherwise, set up a single-byte historical database. First, replace the three <Sybase IQ Database Location> placeholders with a file system location in which to store your database files. Then, run the command:
      dbisqlc -c "uid=dba;eng=myserver;dbn=utility_db" 
      "CREATE DATABASE '<Sybase IQ Database Location>/RAPIQ' 
      IQ SIZE 500 
      IQ PATH '<Sybase IQ Database Location>/RAPIQ.iq' 
      TEMPORARY PATH '<Sybase IQ Database Location>/RAPIQ.iqtmp' 
      TEMPORARY SIZE 1000;"
  8. Customize the configuration of the RAP database.
    1. Make a copy of the default.cfg file located in the <Sybase IQ Install Directory>/IQ-15_4/scripts directory, place it into the <Sybase IQ Database Location>, and rename it RAPIQ.cfg.
      The IQ-15_4 portion of the directory may change if you are using a newer version of Sybase IQ.
    2. Edit the RAPIQ.cfg file with the following changes:

      Use the default Sybase IQ server port of 2638, if possible. If you need to use a different port, update all of the dbisqlc commands in these installation instructions to use your new port and change the line -x tcpip(port=2638) to -x tcpip(port=<new port>).

      1. Add these lines to name your server, allow any user to stop the database, assign a port for the server to start on, and set the main and temp cache size (MB):
        -n RAPIQ
        -gk all
        -x tcpip(port=2638)
        -iqmc 1000
        -iqtc 1000
        If a server called RAPIQ already exists on the same subnet as this machine, choose another name for this server. Change the -n RAPIQ line to -n <Server name>. Also change eng=RAPIQ to eng=<Server name> in all the dbisqlc connections.
      2. Increase the number of connections the Sybase IQ server allows by changing the line that says “-gm 10” to “-gm 100”.
  9. Change the directory to the <Sybase IQ Database Location> and start the RAP database using the command: start_iq @RAPIQ.cfg RAPIQ.db
  10. Create a dbspace in which to store the database data. Run: dbisqlc -c "uid=DBA;eng=RAPIQ;links=tcpip(host=localhost:2638)" $RAP_HOME/databases/iq/scripts/create_dbspace.sql
  11. Create RAP_USER.
    1. Run dbisqlc in interactive mode: dbisqlc -c "uid=DBA;eng=RAPIQ;links=tcpip(host=localhost:2638)"
    2. Replace the <RAP_USER Password> placeholder with a password for RAP_USER, and run: grant connect to RAP_USER IDENTIFIED BY <RAP_USER Password>
  12. Create the RAP schema in the Sybase IQ database:
    1. If you created a historical store with multibyte support, run this command: dbisqlc -c "uid=DBA;eng=RAPIQ;links=tcpip(host=localhost:2638)" $RAP_HOME/databases/iq/scripts/mbcs/create_tables_mbcs.sql
    2. Otherwise, for single-byte only support, run this command: dbisqlc -c "uid=DBA;eng=RAPIQ;links=tcpip(host=localhost:2638)" $RAP_HOME/databases/iq/scripts/create_tables.sql
  13. Load the sample supporting data into the newly created tables in the Sybase IQ database. The sample supporting schema is required to use the RAP sample project.

    If you installed the multibyte schema in the previous step, you can load the default sample supporting data for English (single-byte characters) or for Japanese (multibyte characters). Otherwise, install the single-byte sample data (English). If you install the Japanese sample supporting data, use the Japanese sample input files when you run the RAP project.

    Sample Supporting Data Required Steps

    English

    1. Run this command:
      dbisqlc -c "uid=RAP_USER;eng=RAPIQ;links=tcpip(host=localhost:2638)" $RAP_HOME/databases/iq/scripts/load_tables.sql

    Japanese (multibyte schemas only)

    1. Change directories to $RAP_HOME/databases/iq/data/supportingdata.
    2. To keep a copy of the English sample supporting data for future use, rename the files
      • INSTRUMENT.csv to INSTRUMENT.csv.en
      • and MARKET_INDEX.csv to MARKET_INDEX.csv.en
    3. Copy the INSTRUMENT.csv.jp to INSTRUMENT.csv and MARKET_INDEX.csv.jp to MARKET_INDEX.csv.
    4. Run this command: dbisqlc -c "uid=RAP_USER;eng=RAPIQ;links=tcpip(host=localhost:2638)" $RAP_HOME/databases/iq/scripts/load_tables.sql
  14. (Optional) Load sample data (STOCK_QUOTE and STOCK_TRADE) into the RAP database by running this command: dbisqlc -c "uid=RAP_USER;eng=RAPIQ;links=tcpip(host=localhost:2638)" $RAP_HOME/databases/iq/scripts/load_TAQ_tables.sql
  15. Grant required privileges to RAP_USER by executing this command: dbisqlc -c "uid=DBA;eng=RAPIQ;links=tcpip(host=localhost:2638)" $RAP_HOME/databases/iq/scripts/set_permissions.sql
  16. License your Sybase IQ server using your RAP license if you have not already done so using the installer.
  17. Stop your Sybase IQ server using the command stop_iq.
  18. Restart your Sybase IQ server by changing the directory to the <Sybase IQ Database Location> and running: start_iq @RAPIQ.cfg RAPIQ.db