Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread
Message: 102781
BY: Lucas Maxwell (tism)
DATE: 2012-11-15 04:57
SUBJECT: RE: When to free statements from execute

 

The error returned is:

ActiveRecord::StatementInvalid: RuntimeError: Failed to execute statement due to: [IBM][CLI Driver] CLI0129E An attempt to allocate a handle failed because there are no more handles to allocate. SQLSTATE=HY014 SQLCODE=-99999

So the error actually related to the client, then is it a function of the system's max file handles?

I think I've done a bad job at explaining myself.

When calling ActiveRecord::ConnectionAdapters::IBM_DBAdapter#execute the statement is returned, and that must be freed explicitly. If I free it after execute is run then other methods that use execute such as fetch_data fail because the statement has been freed before the data was fetched.

In essence .execute isn't useable without explicitly calling IBM_DB.free_stmt as over time it will consume all the available handles. I'm trying to find a place that the statement can be released such that the methods that use execute don't have the statement closed before they can use it but execute doesn't pass an unfreed reference back to the user code.

ActiveRecord doesn't appear to have an explicit execute/free structure as the other drivers appear to return results that don't need explicit free'ing.


Thread View

Thread Author Date
When to free statements from executeLucas Maxwell2012-11-15 03:07
      RE: When to free statements from executePraveen Devarao2012-11-15 04:27
            RE: When to free statements from executeLucas Maxwell2012-11-15 04:57
                  RE: When to free statements from executePraveen Devarao2012-11-15 07:52
                        RE: When to free statements from executePraveen Devarao2012-11-15 07:54
                        RE: When to free statements from executeLucas Maxwell2012-11-16 01:04

Post a followup to this message