Oracle adapter + activerecord sessions do not work

Anyone know what’s up with the activerecord session store when using
the oracle adapter in Rails 2.0.2 ?

I can set a session variable and can then see it’s actually set using
the debugger, but after the request completes the session is empty
(the @data member is nil). The session_id is staying the same and the
updated_at field is being updated but nothing I put in a session makes
it to the end of a request.

It’s also worth mentioning the oracle adapter wouldn’t work for me at
all until I found this patch code which provides the select_rows
method, seems they forgot to implement it or something:

require ‘active_record/connection_adapters/oracle_adapter’
module ActiveRecord
module ConnectionAdapters
class OracleAdapter
def select_rows(sql, name = nil)
@connection.query_with_result = true
result = execute(sql, name)
rows = []
result.each { |row| rows << row }
result.free
rows
end
end
end
end

I placed that in environment.rb and it works best I can tell but now I
find my active record sessions are broken. I’m not sure if the two
problems are related.

The default cookie sessions work without an issues.


Greg D.
http://destiney.com/

Greg,
I ran into the same problem. I found the solution here:
http://blog.rayapps.com/2008/01/08/fix-for-rails-20-on-oracle-with-database-session-store/

Basically because the session data is stored in a CLOB you need to
include this in your environment.rb

class CGI::Session::ActiveRecordStore::Session
after_save :write_lobs
end

-Paul

On 1/15/08, paul damer [email protected] wrote:

end
Thanks. I’ll give it a try.


Greg D.
http://destiney.com/