File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -39,17 +39,23 @@ def get_eazy_connect_url(svc_separator = "")
3939 "#{ DATABASE_HOST } :#{ DATABASE_PORT } #{ svc_separator } #{ DATABASE_SERVICE_NAME } "
4040end
4141
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+
4250def get_connection ( user_number = 0 )
4351 database_user , database_password = DATABASE_USERS_AND_PASSWORDS [ user_number ]
4452 unless defined? ( JRUBY_VERSION )
45- url = ( ENV [ 'DATABASE_USE_TNS' ] == 'NO' ) ? get_eazy_connect_url ( "/" ) : DATABASE_NAME
4653 try_to_connect ( OCIError ) do
47- OCI8 . new ( database_user , database_password , url )
54+ OCI8 . new ( database_user , database_password , get_connection_url )
4855 end
4956 else
5057 try_to_connect ( NativeException ) do
51- java . sql . DriverManager . getConnection ( "jdbc:oracle:thin:@#{ DATABASE_HOST } :#{ DATABASE_PORT } #{ DATABASE_SERVICE_NAME } " ,
52- database_user , database_password )
58+ java . sql . DriverManager . getConnection ( get_connection_url , database_user , database_password )
5359 end
5460 end
5561end
You can’t perform that action at this time.
0 commit comments