Jump to content
We've recently updated our Privacy Statement, available here. ×

Writing into the database with JDBC Adapter in Streaming


Mehmed Aktas

Recommended Posts

Hi folks,

I actively use the Streaming JDBC Adapter to retrieve the data into my Streaming Project. The query works in 5 sec intervals, my data in database increments so quickly.

I want to write into the database from my project, actually I want to get rid of the CSV output adapters and directly writing my query tables and other stuff into the DB.

Is there another adapter for writing into DB Should I just use an SQL statement for writing inside the JDBC Query

Link to comment
Share on other sites

Exactly.

 

Use any SQL DML statement in the SQL property of the JDBC Query operator.* Don't let the word query fool you. You can parameterize the evaluation of any valid StreamBase expression into the statement, too, by surrounding the StreamBase expression in curly braces such {input1.myInputField}.

There are a couple samples in available in StreamBase Studio via File > Import Samples or File > Import Samples and Community Content, depending on the version of StreamBase/Streaming you have. Just search for JDBC, import and import the samples. There are a couple of INSERT statement examples such as:

 

INSERT INTO OrderBook VALUES ({QuoteID}, {Symbol}, {Side}, {Price}, {OrderSize}, {ArrivalTime}, {SeqNum})

in the JDBCQuery.sbapp file there.

Writing to a Database is not usually the fastest possible thing you can do, and is usually slower than writing to a CSV file, so keep an eye on things if you go this route.

 

*Some but not all DDL will work, and may or may not be explicitly supported, but that's another discussion. Capabilities will tend to vary a bit at the edges with each JDBC driver, but that's not a behavior that's specifiic to StreamBase.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...