File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 3535# specify which database version is used (will be verified in one test)
3636DATABASE_VERSION = ENV [ 'DATABASE_VERSION' ] || '10.2.0.4'
3737
38+ def get_eazy_connect_url ( svc_separator = "" )
39+ "#{ DATABASE_HOST } :#{ DATABASE_PORT } #{ svc_separator } #{ DATABASE_SERVICE_NAME } "
40+ end
41+
42+ def get_connection_url
43+ unless defined? ( JRUBY_VERSION )
44+ ( ENV [ 'DATABASE_USE_TNS' ] == 'NO' ) ? get_eazy_connect_url ( "/" ) : DATABASE_NAME
45+ else
46+ "jdbc:oracle:thin:@#{ get_eazy_connect_url } "
47+ end
48+ end
49+
3850def get_connection ( user_number = 0 )
3951 database_user , database_password = DATABASE_USERS_AND_PASSWORDS [ user_number ]
4052 unless defined? ( JRUBY_VERSION )
4153 try_to_connect ( OCIError ) do
42- OCI8 . new ( database_user , database_password , DATABASE_NAME )
54+ OCI8 . new ( database_user , database_password , get_connection_url )
4355 end
4456 else
4557 try_to_connect ( NativeException ) do
46- java . sql . DriverManager . getConnection ( "jdbc:oracle:thin:@#{ DATABASE_HOST } :#{ DATABASE_PORT } #{ DATABASE_SERVICE_NAME } " ,
47- database_user , database_password )
58+ java . sql . DriverManager . getConnection ( get_connection_url , database_user , database_password )
4859 end
4960 end
5061end
You can’t perform that action at this time.
0 commit comments