JDBC using adapter (and connection handles)
I wrote the following code on an event server:
This works great, except it is exceedingling slow. I am sending about 20,000 messages to this code.
OracleDataSource ods = new OracleDataSource();
Connection conn = ods.getConnection();
// Check for the existence of a previous customerID
String selectStmt = "SELECT * from STEPS " +
"WHERE (streamID='" +
"') and (assetid='" +
Statement stmt = conn.createStatement();
//System.out.println("-- calling SELECT");
ResultSet rs = stmt.executeQuery(selectStmt);
I think the problem is that I open the connection everytime I perform a select (and later an insert statement).
The server instance goes away after the message has been processed, and I can not save the connection.
Would using an adapter in config.xml prevent this openig a new connection every time a message invokes this code.
If so, I have never done JDBC with an adapter and I dont understand how to use an adapter to use a WHERE clause to select on variables, since in the example I have seen so far, it places "SELECT 1 from DUAL" into the config.xml and does not explain how to get mix have the SELECT statement interact with code variables or better yet how to get your code to get a connection handle.
Could someone please post an exaqmple of how to use an adapter with JDBC, and possibly how to get your code to access a connection handle from the config.xml ?
This is part of a server app that is instantiated everytime a message comes in so I can not