On 23/05/2017 15:14, Bob M wrote:
The error message(s):

mining routine finished
simulation routine commenced
simulation routine finished
final prediction routine commenced
Prediction_Trend: 0.0
Current Trade Direction:
debug: we get to here(8)
final prediction routine finished
Weka non-initialization successful
Weka finished
No. 2 - Initialize: false
No. 2 - myCanTrade: false
No. 2 - do_not_trade: false
No. 2 - curr_trade_dir:
No. 2 - prev_trade_dir: Down
Inserted newest record:- Trading_Date/Trading_Time: 2017-5-23, 12
Oldest record:- Trading_Date/Trading_Time: 2012-02-06, 6
Deleted oldest record

Once again, none of this is generated by the code you posted...

*Adding a new trade record Number: 4101
*

Something very similar is generated by you code (but again, it's not *exactly* the same)...

----- SQLException -----
 SQL State: 23505
 Error Code: 20000
 Message: The statement was aborted because it would have caused a duplicate
key value in a unique or primary key constraint or unique index identified
by 'SQL170412104646890' defined on 'TRADES'.

----- SQLException -----
 SQL State: 25001
 Error Code: 20000
 Message: Cannot close a connection while a transaction is still active.

And here, you should probably print a stacktrace from the exception and look at the line which generates the exception in your code (probably the call to executeUpdate() -- but only you have that information).

And now you have two clues:
1) "The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL170412104646890' defined on 'TRADES'."

So, which constraint might have been violated? (Hint, again: give names to your constraints.) And why might it have happened? (A stacktrace might give you a clue, but since you didn't post one, that's something you'll have to figure out.)

2) "Cannot close a connection while a transaction is still active."

Which connection is being closed, and why is there a transaction still active at the time? (Again, a stacktrace might help to figure out where and why this is happening.)

I'm sorry, but I can't spend any more time trying to understand your problem until you make some more effort to understand your own problem. What you've posted so far is certainly not enough for me to help any further than I already have, but hopefully you'll be able to work it out from the exception messages and the clues you've been given already.

--
John English

Reply via email to