Class: IFD_Connections
- Inherits:
-
Object
- Object
- IFD_Connections
- Defined in:
- lib/Ifd_Automation/methods/IFD_Connection.rb
Class Method Summary collapse
-
.get_mysql_db_connection(schema) ⇒ Object
Open the MYSQL connection to specific schema.
-
.get_sql_server_db_connection(schema) ⇒ Object
Open the SQL Server connection to specific schema.
Class Method Details
.get_mysql_db_connection(schema) ⇒ Object
Open the MYSQL connection to specific schema
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/Ifd_Automation/methods/IFD_Connection.rb', line 6 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.] end end |
.get_sql_server_db_connection(schema) ⇒ Object
Open the SQL Server connection to specific schema
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/Ifd_Automation/methods/IFD_Connection.rb', line 18 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.] end end |