File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -52,26 +52,37 @@ def check_dependencies
52
52
end
53
53
54
54
def connect
55
+ handle = nil
56
+
55
57
if ( not @oci8_loaded )
56
58
raise RuntimeError , "Could not load the Oracle driver (oci8): #{ @oci8_error } "
57
59
end
58
60
59
61
# Create a Connection to the Database
60
62
if datastore [ 'DBUSER' ] == 'SYS' || datastore [ 'DBUSER' ] == 'SYSTEM'
61
- handle = OCI8 . new (
62
- datastore [ 'DBUSER' ] ,
63
- datastore [ 'DBPASS' ] ,
64
- "//#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } /#{ datastore [ 'SID' ] } " ,
65
- :SYSDBA
66
- )
63
+ begin
64
+ handle = OCI8 . new (
65
+ datastore [ 'DBUSER' ] ,
66
+ datastore [ 'DBPASS' ] ,
67
+ "//#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } /#{ datastore [ 'SID' ] } " ,
68
+ :SYSDBA
69
+ )
70
+ rescue ::OCIError
71
+ # Try again without a request for SYSDBA
72
+ handle = OCI8 . new (
73
+ datastore [ 'DBUSER' ] ,
74
+ datastore [ 'DBPASS' ] ,
75
+ "//#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } /#{ datastore [ 'SID' ] } "
76
+ )
77
+ end
67
78
else
68
79
handle = OCI8 . new (
69
80
datastore [ 'DBUSER' ] ,
70
81
datastore [ 'DBPASS' ] ,
71
82
"//#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } /#{ datastore [ 'SID' ] } "
72
83
)
73
84
end
74
-
85
+ handle
75
86
end
76
87
77
88
def disconnect
You can’t perform that action at this time.
0 commit comments