Use a Database Input adapter to connect to and poll a database.
Column | Datatype | Value |
---|---|---|
Ts | datetime | not null |
Symbol | char(4) | not null |
Price | money | not null |
Volume | int | not null |
You also need to create a unique non-clustered index called ind1 on Trades (Ts), and grant all permissions on Trades to public.
<Service Name="dbExample" Type="DB"> <Parameter Name="DriverLibrary">esp_db_jdbc_sybase_lib</Parameter> <Parameter Name="Host">mydbserver</Parameter> <Parameter Name="Port">5000</Parameter> <Parameter Name="User">test4</Parameter> <Parameter Name="Password">password</Parameter> <Parameter Name="Database">interpubs</Parameter> <Parameter Name="ConnectString"></Parameter> <Parameter Name="ConnectionPoolSize">-1</Parameter> </Service>
Populate the table with data, then run the example.
The example creates a schema named TradeSchema, followed by an input window named TradeWindow and output window named TradeOutWindow that each reference TradeSchema. SELECT all (*) syntax outputs all data processed by TradeWindow to TradeOutWindow.
The example attaches a Database Input adapter to TradeWindow to read data from the database you set up as a prerequisite. A poll period of 10 for this adapter instance means that the database is polled for new content every 10 seconds.
ATTACH INPUT ADAPTER dbInConn1 TYPE db_in TO TradeWindow PROPERTIES service = 'dbExample' , query = 'Select * from Trades' , table = 'Trades' , pollperiod =0 , dateFormat = '%Y-%m-%d %H:%M:%S' , timestampFormat = '%Y-%m-%d %H:%M:%S' ;