support oci8 privilege.

50 views
Skip to first unread message

Colin Jack

unread,
Dec 17, 2008, 9:29:37 PM12/17/08
to Oracle enhanced adapter for ActiveRecord
hello everybody, I'm bad in english.
oci8 support privilege, that can connect oracle as sysdba.
But Oracle enhanced adapter not surpport.

I hope Oracle enhanced adapter can surpport it too. Thank you.
Actually, supportion is simple.
first in class OCI8EnhancedAutoRecover

def initialize(config, factory =
OracleEnhancedConnectionFactory.new)
@active = true
@username, @password, @database, = config[:username].to_s, config
[:password].to_s, config[:database].to_s
@async = config[:allow_concurrency]
@prefetch_rows = config[:prefetch_rows] || 100
@cursor_sharing = config[:cursor_sharing] || 'similar'
@factory = factory
@privilege = config[:privilege] # add
@connection = @factory.new_connection @username, @password,
@database, @async, @prefetch_rows, @cursor_sharing, @privilege #
add
super @connection
end

second in class OracleEnhancedConnectionFactory
def new_connection(username, password, database, async,
prefetch_rows, cursor_sharing, privilege) #add
conn = OCI8.new username, password, database, privilege #add
conn.exec %q{alter session set nls_date_format = 'YYYY-MM-DD
HH24:MI:SS'}
conn.exec %q{alter session set nls_timestamp_format = 'YYYY-MM-
DD HH24:MI:SS'} rescue nil
conn.autocommit = true
conn.non_blocking = true if async
conn.prefetch_rows = prefetch_rows
conn.exec "alter session set cursor_sharing = #{cursor_sharing}"
rescue nil
conn
end

last in class OCI8EnhancedAutoRecover
def reset!
logoff rescue nil
begin
@connection = @factory.new_connection @username, @password,
@database, @async, @prefetch_rows, @cursor_sharing, @privilege #add
__setobj__ @connection
@active = true
rescue
@active = false
raise
end
end

Raimonds Simanovskis

unread,
Dec 18, 2008, 3:40:14 AM12/18/08
to Oracle enhanced adapter for ActiveRecord
I am just wondering why you need connect to Oracle as SYSDBA in Rails
application?
I think that you need SYSDBA privilege just for administration tasks
and it should not be used when running applications.

Raimonds

Colin Jack

unread,
Dec 19, 2008, 7:01:46 PM12/19/08
to Oracle enhanced adapter for ActiveRecord
Yes, you right.
I'm not use in rails. I just ues ActiveRecord in my project.
If the Database at standby, do sql must need SYSDBA privilege.
Of course, I can just use oci8, but it's so inconvenient, when I used
to ActiveRecord.

Raimonds Simanovskis

unread,
Dec 20, 2008, 3:50:15 AM12/20/08
to Oracle enhanced adapter for ActiveRecord
OK, I will add this to feature list and hopefully will include this in
next version of adapter.

Raimonds

Colin J

unread,
Dec 20, 2008, 7:59:41 AM12/20/08
to oracle-...@googlegroups.com
Thank you so much, that very help to me.

2008/12/20 Raimonds Simanovskis <raimonds.s...@gmail.com>
Reply all
Reply to author
Forward
0 new messages