Creating the Stock Ticker Application

The following example is a stock ticker application that uses the Universal Connection Pool to retrieve stock price information from the database. Using this example, you can view the Universal Connection Pool properties, change the properties at run time without shutting down the pool instance, view Universal Connection Statistics and so on. Perform the following steps to run the example:

  1. Click New Application in the Application Navigator panel.

    Figure 8-4 The Application Navigator Panel Options

    Description of Figure 8-4 follows
    Description of "Figure 8-4 The Application Navigator Panel Options"
  2. Enter StockTickerApp as the Application Name in the Name Your Application screen and click Next.
  3. Enter StockTickerProj as the Project Name in the Name Your Project screen and click Finish.
  4. Click Open from File menu.
  5. Select the UCPDemo.java, ClientSimulator.java, DBConfig.java, HttpServer.java, and DbConfig.properties files and click Open.
  6. In the DbConfig.properties file, verify the information about the user name, the password, and the URL of your Oracle database.

    Figure 8-5 The DbConfig.properties File in the Code Editor

    Description of Figure 8-5 follows
    Description of "Figure 8-5 The DbConfig.properties File in the Code Editor"
  7. Right-click the UCPDemo.java tab in the code editor and select Add to StockTickerProj.jpr.

    Figure 8-6 Adding a Source File to a Project

    Description of Figure 8-6 follows
    Description of "Figure 8-6 Adding a Source File to a Project"
  8. Retain the default value for the content path in the Add to Project Content screen and click OK.

    Figure 8-7 The Add to Project Content

    Description of Figure 8-7 follows
    Description of "Figure 8-7 The Add to Project Content"
  9. Repeat steps 7 and 8 for ClientSimulator.java, DBConfig.java, HttpServer.java, and DbConfig.properties files to add them to the StockTickerProj project.
  10. Right-click the UCPDemo.java file in the Application Navigator window and click Make.
  11. Select Choose Active Run Configuration from the Run menu and then select Manage Run Configurations.

    Figure 8-8 The Run Menu Options

    Description of Figure 8-8 follows
    Description of "Figure 8-8 The Run Menu Options"
  12. Click Edit in the Project Properties screen for the StockTickerProj project.

    Figure 8-9 The Project Properties Screen for the StockTickerProj Project

    Description of Figure 8-9 follows
    Description of "Figure 8-9 The Project Properties Screen for the StockTickerProj Project"

    The Edit Run Configuration screen is displayed.

  13. Enter 8067 or any free port on your system in the Program Arguments field and click OK.

    Figure 8-10 The Edit Run Configuration Screen

    Description of Figure 8-10 follows
    Description of "Figure 8-10 The Edit Run Configuration Screen"
  14. Click OK to exit the Project Properties screen.
  15. Right-click the UCPDemo.java file in the Application Navigator window and click Run.