Skip to content

Commit c3f7726

Browse files
authored
Merge pull request #162 from praveen-db2/master
Enhance ruby-ibmdb adapter to read Db2 credential from Env var for testing
2 parents 841df4d + 944bcf1 commit c3f7726

5 files changed

Lines changed: 72 additions & 12 deletions

File tree

IBM_DB_Adapter/ibm_db/CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Change Log
22
==============
3+
2023/10/11 (IBM_DB adapter 5.4.2, driver 3.1.0)
4+
- config.yml to have Environment variables to specify credentials.
5+
36
2023/03/29 (IBM_DB adapter 5.4.1, driver 3.1.0)
47
- Download clidriver issue fixed and replaced http links with https.
58

IBM_DB_Adapter/ibm_db/IBM_DB.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require 'pathname'
1010
Gem::Specification.new do |spec|
1111
# Required spec
1212
spec.name = 'ibm_db'
13-
spec.version = '5.4.1'
13+
spec.version = '5.4.2'
1414
spec.summary = 'Rails Driver and Adapter for IBM Data Servers: {DB2 on Linux/Unix/Windows, DB2 on zOS, DB2 on i5/OS, Informix (IDS)}'
1515

1616
# Optional spec

IBM_DB_Adapter/ibm_db/README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Testing the IBM_DB Adapter
133133
2) Edit the Rakefile to include ibm_db in list of adapters
134134
%w( mysql mysql2 postgresql sqlite3 sqlite3_mem firebird db2 oracle sybase openbase ibm_db frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb )
135135
3) Configure the connection information in test/config.yml for ibm_db
136+
Set Environment Variables DB2_USER1, DB2_PASSWD1, DB2_DATABASE1, DB2_HOST1, DB2_PORT1 etc... accordingly.
136137
4) run the test suite - rake test_ibm_db
137138

138139
Running IBM_DB driver test suite

IBM_DB_Adapter/ibm_db/test/config.yml

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,82 @@ connections:
4848
database: arunit2
4949

5050
ibm_db:
51+
<% env_not_set = false %>
5152
arunit:
52-
username: dbuser
53-
password: dbpass
54-
database: bjhadb
55-
host: waldevdbclnxtst06.dev.rocketsoftware.com
56-
port: 60000
53+
<% if ENV['DB2_USER1'] %>
54+
username: <%= ENV['DB2_USER1'] %>
55+
<% else %>
56+
<% puts "Warning: Environment variable DB2_USER1 is not set." %>
57+
<% env_not_set = true %>
58+
<% end %>
59+
<% if ENV['DB2_PASSWD1'] %>
60+
password: <%= ENV['DB2_PASSWD1'] %>
61+
<% else %>
62+
<% puts "Warning: Environment variable DB2_PASSWD1 is not set." %>
63+
<% env_not_set = true %>
64+
<% end %>
65+
<% if ENV['DB2_DATABASE1'] %>
66+
database: <%= ENV['DB2_DATABASE1'] %>
67+
<% else %>
68+
<% puts "Warning: Environment variable DB2_DATABASE1 is not set." %>
69+
<% env_not_set = true %>
70+
<% end %>
71+
<% if ENV['DB2_HOST1'] %>
72+
host: <%= ENV['DB2_HOST1'] %>
73+
<% else %>
74+
<% puts "Warning: Environment variable DB2_HOST1 is not set." %>
75+
<% env_not_set = true %>
76+
<% end %>
77+
<% if ENV['DB2_PORT1'] %>
78+
port: <%= ENV['DB2_PORT1'] %>
79+
<% else %>
80+
<% puts "Warning: Environment variable DB2_PORT1 is not set." %>
81+
<% env_not_set = true %>
82+
<% end %>
5783
start_id: 1000
5884
parameterized: true
5985
statement_limit: 1000
6086
# debug: true
6187
arunit2:
62-
username: dbuser
63-
password: dbpass
64-
database: sample
65-
host: waldevdbclnxtst06.dev.rocketsoftware.com
66-
port: 60000
88+
<% if ENV['DB2_USER2'] %>
89+
username: <%= ENV['DB2_USER2'] %>
90+
<% else %>
91+
<% puts "Warning: Environment variable DB2_USER2 is not set." %>
92+
<% env_not_set = true %>
93+
<% end %>
94+
<% if ENV['DB2_PASSWD2'] %>
95+
password: <%= ENV['DB2_PASSWD2'] %>
96+
<% else %>
97+
<% puts "Warning: Environment variable DB2_PASSWD2 is not set." %>
98+
<% env_not_set = true %>
99+
<% end %>
100+
<% if ENV['DB2_DATABASE2'] %>
101+
database: <%= ENV['DB2_DATABASE2'] %>
102+
<% else %>
103+
<% puts "Warning: Environment variable DB2_DATABASE2 is not set." %>
104+
<% env_not_set = true %>
105+
<% end %>
106+
<% if ENV['DB2_HOST2'] %>
107+
host: <%= ENV['DB2_HOST2'] %>
108+
<% else %>
109+
<% puts "Warning: Environment variable DB2_HOST2 is not set." %>
110+
<% env_not_set = true %>
111+
<% end %>
112+
<% if ENV['DB2_PORT2'] %>
113+
port: <%= ENV['DB2_PORT2'] %>
114+
<% else %>
115+
<% puts "Warning: Environment variable DB2_PORT2 is not set." %>
116+
<% env_not_set = true %>
117+
<% end %>
67118
start_id: 1000
68119
parameterized: true
69120
statement_limit: 1000
70121
# debug: true
122+
<% if env_not_set == true %>
123+
<% puts "Please set it before running test file and avoid" %>
124+
<% puts "hardcoded password in confi.yml file." %>
125+
<% exit(1) %>
126+
<% end %>
71127

72128
firebird:
73129
arunit:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ruby-ibmdb
33
Rails Adapter/Ruby Driver for IBM Data Servers: {DB2 on Linux/Unix/Windows, DB2 on zOS, DB2 on IBMi, IBM Informix (IDS)}
44

55
```
6-
ibm_db gem version 5.4.0
6+
ibm_db gem version 5.4.2
77
88
Requirements:
99
Ruby should be installed(Ruby version should be >=2.5.x and <= 3.1.x)

0 commit comments

Comments
 (0)