Class: JDBCHelper::OracleConnector

Inherits:
Connector
  • Object
show all
Includes:
Constants, Constants::Connector
Defined in:
lib/jdbc-helper/connector/oracle_connector.rb

Overview

Shortcut connector for Oracle

Constant Summary

Constants included from Constants::Connector

Constants::Connector::DEFAULT_PARAMETERS, Constants::Connector::JDBC_DRIVER

Constants included from Constants

Constants::DEFAULT_LOGIN_TIMEOUT

Class Method Summary collapse

Class Method Details

.connect(host, user, password, service_name, timeout = DEFAULT_LOGIN_TIMEOUT, &block) ⇒ JDBCHelper::Connection

Parameters:

  • host (String)
  • user (String)
  • password (String)
  • service_name (String)
  • timeout (Fixnum) (defaults to: DEFAULT_LOGIN_TIMEOUT)

Returns:



16
17
18
19
20
21
22
23
24
25
# File 'lib/jdbc-helper/connector/oracle_connector.rb', line 16

def self.connect(host, user, password, service_name, timeout = DEFAULT_LOGIN_TIMEOUT, &block)
	conn = Connection.new(
		:driver   => JDBC_DRIVER[:oracle],
		:url      => "jdbc:oracle:thin:@#{host}/#{service_name}",
		:user     => user,
		:password => password,
		:timeout  => timeout)

	block_given? ? ensure_close(conn, &block) : conn
end

.connect_by_sid(host, user, password, sid, timeout = DEFAULT_LOGIN_TIMEOUT, &block) ⇒ JDBCHelper::Connection

Parameters:

  • host (String)
  • user (String)
  • password (String)
  • sid (String)
  • timeout (Fixnum) (defaults to: DEFAULT_LOGIN_TIMEOUT)

Returns:



33
34
35
36
37
38
39
40
41
42
# File 'lib/jdbc-helper/connector/oracle_connector.rb', line 33

def self.connect_by_sid(host, user, password, sid, timeout = DEFAULT_LOGIN_TIMEOUT, &block)
	conn = Connection.new(
		:driver   => JDBC_DRIVER[:oracle],
		:url      => "jdbc:oracle:thin:@#{host}:#{sid}",
		:user     => user,
		:password => password,
		:timeout  => timeout)

	block_given? ? ensure_close(conn, &block) : conn
end