简体   繁体   English

Ruby OCI8无法注销连接后果

[英]Ruby OCI8 not logging off connection consequences

What are the consequences, (if any) not calling the conn.logoff() method after the following script when connecting to an Oracle database using the Ruby OCI8 library. 使用Ruby OCI8库连接到Oracle数据库时,如果在以下脚本之后不调用conn.logoff()方法,将会有什么后果(如果有的话)。

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. 我之所以这样问,是因为我们在连接到同一Oracle数据库的其他应用程序中遇到了速度下降的问题。

Thanks 谢谢

I would imagine that when the Ruby process exits, the session will be killed automatically. 我可以想象,当Ruby进程退出时,会话将被自动终止。

You could check by querying v$session to see if the ruby process is still connected to Oracle after Ruby exits. 您可以通过查询v $ session来检查,以查看Ruby退出后ruby进程是否仍仍连接到Oracle。

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. 如果您不调用conn.logoff(),则该连接将处于活动状态,即使该连接已被垃圾回收,直到ruby进程退出为止。 The problem is fixed in ruby-oci8 2.1, which have not been released yet though. 该问题已在ruby-oci8 2.1中修复,但尚未发布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM