Sha256: b98d6dd7197dca37dbf8cc2dabfc11445fe2f8434a8939603a021de00d828ac1

Contents?: true

Size: 1.28 KB

Versions: 26

Compression:

Stored size: 1.28 KB

Contents

require 'mysql2'
require 'tiny_tds'

class IFD_Connections
  # Open the  MYSQL connection to specific schema
  def self.get_mysql_db_connection(schema)
    begin
      # puts ("Connecting to database...");
      data_source_schema = schema.downcase
      return Mysql2::Client.new(host: $data_source_url, username: $data_source_username, password: $data_source_password,database:data_source_schema);
    rescue Exception => e
      raise "Cannot connect to database [username: %s; password: %s, dbUrl: %s, dbName: %s] with error %s" %
                [$data_source_username, $data_source_password, $data_source_url,data_source_schema, e.message]
    end
  end

  # Open the  SQL Server connection to specific schema
  def self.get_sql_server_db_connection(schema)
    begin
      # puts ("Connecting to database...");
      data_source_schema = schema.downcase
      return TinyTds::Client.new(dataserver: $data_source_url, username: $data_source_username, password: $data_source_password, database:data_source_schema);
    rescue Exception => e
      raise "Cannot connect to database [username: %s; password: %s, dbUrl: %s, dbName: %s] with error %s" %
                [$data_source_username, $data_source_password, $data_source_url,data_source_schema, e.message]
    end
  end
end

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
Ifd_Mobile-1.4.0 lib/Ifd_Mobile/methods/IFD_Connection.rb
Ifd_Automation-1.6.0 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-1.5.0 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-1.4.0 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Mobile-1.3.0 lib/Ifd_Mobile/methods/IFD_Connection.rb
Ifd_Mobile-1.2.0 lib/Ifd_Mobile/methods/IFD_Connection.rb
Ifd_Automation-1.3.0 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Mobile-1.1.0 lib/Ifd_Mobile/methods/IFD_Connection.rb
Ifd_Automation-1.2.0 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-1.1.0 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Mobile-1.0.0 lib/Ifd_Mobile/methods/IFD_Connection.rb
Ifd_Automation-1.0 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Mobile-0.1.8 lib/Ifd_Mobile/methods/IFD_Connection.rb
Ifd_Automation-0.1.8 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-0.1.7 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-0.1.6 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-0.1.5 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-0.1.4 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-0.1.3 lib/Ifd_Automation/methods/IFD_Connection.rb
Ifd_Automation-0.1.2 lib/Ifd_Automation/methods/IFD_Connection.rb