Reading Data from kdb+

Use a database subquery to read data from kdb+ into Sybase CEP Engine.

To get data from kdb+ into Sybase CEP Engine, use a database subquery. For example:
INSERT INTO OutStream
SELECT 
    DbResult.StockSymbol,
    DbResult.Price,
    DbResult.Volume
FROM 
    PulseStream,
    (DATABASE "MyKdbService"
     SCHEMA (StockSymbol STRING,
             Price FLOAT,
             Volume INTEGER)
     [[select StockSymbol, Price, Volume from trades]]
    ) as DbResult
;
This query tells Sybase CEP Server which database to connect to by specifying:
DATABASE "MyKdbService"

Ensure the service name, MyKdbService is defined in the c8-services.xml file.

Sybase CEP Server extracts the query
select StockSymbol, Price, Volume from trades
from the database subquery and sends this query to the kdb+ server, which executes the query and returns the requested data. Use the q language to write the query that you send to the kdb+ server. The query may use parameters.