Module: SCAnalytics::Connections::ConnectionPool

Defined in:
lib/sc_analytics/connections/connection_pool.rb

Class Method Summary collapse

Class Method Details

.establish_connection_to(server_name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sc_analytics/connections/connection_pool.rb', line 12

def self.establish_connection_to(server_name)
	config = Credentials.connection_details server_name
	@active_connections[server_name] = case Credentials.connection_type(server_name)
	when "oracle"
		require 'sc_analytics/connections/oracle'
		Oracle.new server_name, config
	when "mysql"
		Mysql.new server_name, config
	else
		raise
	end

	@active_connections[server_name]
end

.get_connection_to(server_name) ⇒ Object



6
7
8
9
10
# File 'lib/sc_analytics/connections/connection_pool.rb', line 6

def self.get_connection_to(server_name)
	establish_connection_to server_name.downcase.to_sym unless @active_connections[server_name.downcase.to_sym]

	@active_connections[server_name.downcase.to_sym]
end