开发者

Ruby OCI8 not logging off connection consequences

开发者 https://www.devze.com 2022-12-21 18:50 出处:网络
What are the consequences, (if any) not calling the conn.logoff() method after the following script when connect开发者_开发知识库ing to an Oracle database using the Ruby OCI8 library.

What are the consequences, (if any) not calling the conn.logoff() method after the following script when connect开发者_开发知识库ing to an Oracle database using the Ruby OCI8 library.

conn = OCI8.new('scott', 'tiger')
 num_rows = conn.exec('SELECT * FROM emp') do |r|
   puts r.join(',')
 end
 puts num_rows.to_s + ' rows were processed.'

The reason I'm asking because we're experiencing slow downs with other applications that connect to this same Oracle db.

Thanks


I would imagine that when the Ruby process exits, the session will be killed automatically.

You could check by querying v$session to see if the ruby process is still connected to Oracle after Ruby exits.

Given only the information in your question, its really impossible to say what could be causing slowdowns - there are so many variable.


If you don't call conn.logoff(), the connection is alive even though it is garbage-collected until the ruby process exits. The problem is fixed in ruby-oci8 2.1, which have not been released yet though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号