ibmi_db 2.5.14-powerpc-aix-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGES +3 -0
- data/LICENSE +18 -0
- data/MANIFEST +24 -0
- data/README +1 -0
- data/README_IBM_i +458 -0
- data/ext/extconf.rb +202 -0
- data/ext/ibm_db.c +12452 -0
- data/ext/ruby_ibm_db.h +191 -0
- data/ext/ruby_ibm_db_cli.c +2453 -0
- data/ext/ruby_ibm_db_cli.h +499 -0
- data/ext/ruby_sql_com.h +143 -0
- data/ext/ruby_sql_luw.h +250 -0
- data/ext/ruby_sql_pase.h +206 -0
- data/lib/IBM_DB.rb +3 -0
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +3782 -0
- data/lib/active_record/connection_adapters/ibm_db_password.rb +212 -0
- data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1965 -0
- data/lib/active_record/connection_adapters/ibmdb_adapter.rb +2 -0
- data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -0
- data/lib/ibm_db.so +0 -0
- data/version.txt +1 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 49ab48851a53065c832421e2d84ca89dae70c6ad
|
4
|
+
data.tar.gz: 6ddb8ca2d1992640c543ecf258e64260387ecad2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c0f1171662983775eef57ce6094fa0dd691b705212134aaed03f07ccbe3731b70fbcaa33dba58b90a7d4292bc6c88c7bde3afa93795c70b7b24b8a5e337fd6fa
|
7
|
+
data.tar.gz: fa29197f8c0f13558e2cad80721f723c704b3c9eeeb233a89e301817fafbe8dc4ba598e65e559261c27e280e09a047f0f9f0004963e47701be38f130214bbb6f
|
data/CHANGES
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (c) 2006, 2007, 2008, 2009, 2010 IBM Corporation
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the "Software"),
|
5
|
+
to deal in the Software without restriction, including without limitation
|
6
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7
|
+
and/or sell copies of the Software, and to permit persons to whom the Software
|
8
|
+
is furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included
|
11
|
+
in all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
14
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
15
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
16
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
17
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
18
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/MANIFEST
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
CHANGES
|
2
|
+
LICENSE
|
3
|
+
MANIFEST
|
4
|
+
README
|
5
|
+
README_IBM_i
|
6
|
+
ext/extconf.rb
|
7
|
+
ext/ibm_db.c
|
8
|
+
ext/ruby_ibm_db_cli.c
|
9
|
+
ext/ruby_ibm_db_cli.h
|
10
|
+
ext/ruby_ibm_db.h
|
11
|
+
ext/ruby_sql_com.h
|
12
|
+
ext/ruby_sql_luw.h
|
13
|
+
ext/ruby_sql_pase.h
|
14
|
+
lib/mswin32/ibm_db.so
|
15
|
+
lib/mswin32/ibm_db.so
|
16
|
+
lib/IBM_DB.rb
|
17
|
+
lib/active_record/connection_adapters/ibm_db_adapter.rb
|
18
|
+
lib/active_record/connection_adapters/ibmdb_adapter.rb
|
19
|
+
lib/active_record/connection_adapters/ibm_db_password.rb
|
20
|
+
lib/active_record/connection_adapters/ibm_db_pstmt.rb
|
21
|
+
lib/active_record/vendor/db2-i5-zOS.yaml
|
22
|
+
test/IBMi/Rakefile
|
23
|
+
test/IBMi/README_IBM_i
|
24
|
+
MANIFEST
|
data/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
See READ_ME_i
|
data/README_IBM_i
ADDED
@@ -0,0 +1,458 @@
|
|
1
|
+
==================
|
2
|
+
Introduction
|
3
|
+
==================
|
4
|
+
The following notes are for Ruby with IBM i.
|
5
|
+
|
6
|
+
======================
|
7
|
+
Environment variables:
|
8
|
+
======================
|
9
|
+
Compile time:
|
10
|
+
IBM_DB_HOME - LUW compile IBM_DB_HOME=/home/db2inst2/sqllib (LUW DB2)
|
11
|
+
IBM_DB_UTF8 - LUW & IBM i compile with UTF-8 override (UTF8_ONLY)
|
12
|
+
Run time:
|
13
|
+
IBM_DB_ON_ERROR=on - ALL ignore missing attributes older drivers
|
14
|
+
IBM_DB_TRACE - dump trace all CLI calls used
|
15
|
+
=on - dump trace to STDOUT
|
16
|
+
=/path/my.log - dump trace to log
|
17
|
+
IBM_DB_TRACE_ERROR=on - used with IBM_DB_TRACE, select only SQLGetDiagRec
|
18
|
+
IBM_DB_STOP - ONLY if trace active, force exit on SQLGetDiag
|
19
|
+
IBM_DB_GIL - map allow GIL/GVL release during operation
|
20
|
+
(note IBM_DB_GIL may be removed)
|
21
|
+
|
22
|
+
Env var for GIL/GVL map:
|
23
|
+
00000000001111111111222222222233333333334444
|
24
|
+
01234567890123456789012345678901234567890123
|
25
|
+
||||||||||||||||||||||||||||||||||||||||||||
|
26
|
+
export IBM_DB_GIL="11111111111111111111111111111111111111111111"
|
27
|
+
||||||||||||||||||||||||||||||||||||||||||||
|
28
|
+
|||||||||||||||||||||||||||||||||||||||||||SQLBindParameter
|
29
|
+
||||||||||||||||||||||||||||||||||||||||||SQLBindFileToParam
|
30
|
+
||||||||||||||||||||||||||||||||||||||||||SQLRowCount
|
31
|
+
|||||||||||||||||||||||||||||||||||||||||SQLNumParams
|
32
|
+
||||||||||||||||||||||||||||||||||||||||SQLNumResultCols
|
33
|
+
|||||||||||||||||||||||||||||||||||||||SQLFetch
|
34
|
+
||||||||||||||||||||||||||||||||||||||SQLFetchScroll
|
35
|
+
|||||||||||||||||||||||||||||||||||||SQLNextResult
|
36
|
+
||||||||||||||||||||||||||||||||||||SQLGetSubString
|
37
|
+
|||||||||||||||||||||||||||||||||||SQLGetLength
|
38
|
+
||||||||||||||||||||||||||||||||||SQLGetData
|
39
|
+
|||||||||||||||||||||||||||||||||SQLPutData
|
40
|
+
||||||||||||||||||||||||||||||||SQLColAttributes
|
41
|
+
|||||||||||||||||||||||||||||||SQLParamData
|
42
|
+
||||||||||||||||||||||||||||||SQLExecute
|
43
|
+
|||||||||||||||||||||||||||||SQLFreeStmt
|
44
|
+
||||||||||||||||||||||||||||SQLGetEnvAttr
|
45
|
+
|||||||||||||||||||||||||||SQLGetConnectAttr
|
46
|
+
|||||||||||||||||||||||||SQLGetStmtAttr
|
47
|
+
||||||||||||||||||||||||SQLSetEnvAttr
|
48
|
+
|||||||||||||||||||||||SQLSetConnectAttr
|
49
|
+
||||||||||||||||||||||SQLSetStmtAttr
|
50
|
+
|||||||||||||||||||||SQLGetDiagRec
|
51
|
+
||||||||||||||||||||SQLGetInfo
|
52
|
+
|||||||||||||||||||SQLPrepare
|
53
|
+
||||||||||||||||||SQLDropDB
|
54
|
+
|||||||||||||||||SQLCreateDB
|
55
|
+
||||||||||||||||SQLExecDirect
|
56
|
+
|||||||||||||||SQLTables
|
57
|
+
||||||||||||||SQLTablePrivileges
|
58
|
+
|||||||||||||SQLStatistics
|
59
|
+
||||||||||||SQLSpecialColumns
|
60
|
+
|||||||||||SQLProcedures
|
61
|
+
||||||||||SQLProcedureColumns
|
62
|
+
|||||||||SQLForeignKeys
|
63
|
+
||||||||SQLPrimaryKeys
|
64
|
+
|||||||SQLColumns
|
65
|
+
||||||SQLColumnPrivilege
|
66
|
+
|||||SQLBindCol
|
67
|
+
||||SQLDescribeCol
|
68
|
+
|||SQLDescribeParam
|
69
|
+
||SQLEndTran
|
70
|
+
|SQLDisconnect
|
71
|
+
SQLConnect
|
72
|
+
|
73
|
+
|
74
|
+
==================
|
75
|
+
Release minimums
|
76
|
+
==================
|
77
|
+
IBM i: V7R1 -- enable lib/file and schema.table syntax in system naming mode (*LIBL mode)
|
78
|
+
LUW: V10.5 -- enables system naming mode and other attributes LUW -> IBM i (*LIBL, attr job, etc.)
|
79
|
+
If you choose a lower release LUW, unsupported extended attributes will fail.
|
80
|
+
However, you may be able to run partially using a new on-error env var.
|
81
|
+
IBM_DB_ON_ERROR=yes
|
82
|
+
|
83
|
+
==================
|
84
|
+
Traditional open passwords
|
85
|
+
==================
|
86
|
+
database.yml
|
87
|
+
db2profile: &db2profile
|
88
|
+
adapter: ibm_db
|
89
|
+
database: "*LOCAL"
|
90
|
+
username: DB2
|
91
|
+
password: MYPWD
|
92
|
+
development:
|
93
|
+
<<: *db2profile
|
94
|
+
test:
|
95
|
+
<<: *db2profile
|
96
|
+
production:
|
97
|
+
<<: *db2profile
|
98
|
+
|
99
|
+
==================
|
100
|
+
Encrypted passwords
|
101
|
+
==================
|
102
|
+
ibm_db APIS:
|
103
|
+
1) generate site encryption key (key.yml)
|
104
|
+
pwd_key = ActiveRecord::Base.ibm_db_generate_key()
|
105
|
+
result:
|
106
|
+
pwd_key - 32 character encryption key site key.yml
|
107
|
+
(one key all passwords, read by ibm_db runtime)
|
108
|
+
example:
|
109
|
+
puts ActiveRecord::Base.ibm_db_generate_key
|
110
|
+
|
111
|
+
2) generate encrypted passord (password.yml)
|
112
|
+
pwd_enc = ActiveRecord::Base.ibm_db_generate_password(password,pwd_key)
|
113
|
+
parameters:
|
114
|
+
password - user password (clear text)
|
115
|
+
pwd_key - 32 character encryption key
|
116
|
+
result:
|
117
|
+
pwd_enc - encrypted password cut/paste password.yml
|
118
|
+
example:
|
119
|
+
puts ActiveRecord::Base.ibm_db_generate_password("MYPASS","YIPS4321AAAAAAAAAAAAAAA132424245")
|
120
|
+
|
121
|
+
Example files:
|
122
|
+
database.yml
|
123
|
+
db2profile: &db2profile
|
124
|
+
adapter: ibm_db
|
125
|
+
database: "*LOCAL"
|
126
|
+
username: DB2
|
127
|
+
pwd_yaml: /my/safe/path/password.yml
|
128
|
+
development:
|
129
|
+
<<: *db2profile
|
130
|
+
test:
|
131
|
+
<<: *db2profile
|
132
|
+
production:
|
133
|
+
<<: *db2profile
|
134
|
+
|
135
|
+
/my/safe/path/password.yml (userid:, pwd_enc:)
|
136
|
+
key_yaml: /my/really/safe/path/key.yml
|
137
|
+
DB2:
|
138
|
+
pwd_enc: "alkqap/Ao7ACWwizSQ2JvZ86+s0yR5FdDmIU68JuQv4=%0A"
|
139
|
+
FLINROCK:
|
140
|
+
pwd_enc: "alkqap/Ao7ACWwizSQ2Jvrdt+s0yR5FdDmIU68JuQv4=%0A"
|
141
|
+
SLATER:
|
142
|
+
pwd_enc: "alkqap/Ao7A123izSQ2Jvrdt+s0yR5FdDmIU68JuQv4=%0A"
|
143
|
+
|
144
|
+
/my/really/safe/path/key.yml (pwd_key:)
|
145
|
+
pwd_key: "YIPS4321AAAAAAAAAAAAAAA132424245"
|
146
|
+
|
147
|
+
=================
|
148
|
+
ibm_db IBM i tests (IBM i or LUW -> IBM i)
|
149
|
+
=================
|
150
|
+
cd test/IBMi/tests (see README_IBM_I)
|
151
|
+
> rake
|
152
|
+
Note:
|
153
|
+
DB2 authorization test/IBMi/tests/config.yml,
|
154
|
+
update with your DB2 profile for testing.
|
155
|
+
|
156
|
+
=================
|
157
|
+
ibm_db IBM i samples (IBM i or LUW -> IBM i)
|
158
|
+
=================
|
159
|
+
cd test/IBMi/samples (see README_IBM_I)
|
160
|
+
Note:
|
161
|
+
DB2 authorization test/IBMi/samples/config.yml,
|
162
|
+
update with your DB2 profile.
|
163
|
+
|
164
|
+
==================
|
165
|
+
Use attribute IBMi_
|
166
|
+
-> IBM i (1-tier)
|
167
|
+
-> LUW->IBM i (2-tier)
|
168
|
+
==================
|
169
|
+
IBM_DB::SQL_IBMi_FMT_ISO (not platform unique IBM_DB::SQL_FMT_ISO)
|
170
|
+
IBM_DB::SQL_IBMi_FMT_USA (not platform unique IBM_DB::SQL_FMT_USA)
|
171
|
+
IBM_DB::SQL_IBMi_FMT_EUR (not platform unique IBM_DB::SQL_FMT_EUR)
|
172
|
+
IBM_DB::SQL_IBMi_FMT_JIS (not platform unique IBM_DB::SQL_FMT_JIS)
|
173
|
+
IBM_DB::SQL_IBMi_FMT_MDY (not platform unique IBM_DB::SQL_FMT_DMY)
|
174
|
+
IBM_DB::SQL_IBMi_FMT_DMY (not platform unique IBM_DB::SQL_FMT_MDY)
|
175
|
+
IBM_DB::SQL_IBMi_FMT_YMD (not platform unique IBM_DB::SQL_FMT_YMD)
|
176
|
+
IBM_DB::SQL_IBMi_FMT_JUL (not platform unique IBM_DB::SQL_FMT_JUL)
|
177
|
+
IBM_DB::SQL_IBMi_FMT_JOB (not platform unique IBM_DB::SQL_FMT_JOB)
|
178
|
+
IBM_DB::SQL_IBMi_FMT_HMS (not platform unique IBM_DB::SQL_FMT_HMS)
|
179
|
+
|
180
|
+
==================
|
181
|
+
Rubtime CLI debug help
|
182
|
+
==================
|
183
|
+
If you wish to see all the CLI calls, set the
|
184
|
+
following env var before running your script
|
185
|
+
IBM_DB_TRACE=on (STDOUT)
|
186
|
+
-- or --
|
187
|
+
IBM_DB_TRACE=/path/my.log
|
188
|
+
|
189
|
+
|
190
|
+
==================
|
191
|
+
compile IBM i PASE
|
192
|
+
==================
|
193
|
+
0) Most use gcc compiler (download http://www.youngiprofessionals.com/wiki/index.php/PASE/GCC )
|
194
|
+
1) Copy SQ headers
|
195
|
+
zzcopyincludes_ibm_i.sh:
|
196
|
+
#!/QOpenSys/usr/bin/ksh
|
197
|
+
ls /QIBM/include/sql* > ./list2
|
198
|
+
for i in $(< ./list2)
|
199
|
+
do
|
200
|
+
echo "PREPARATION COPY"
|
201
|
+
system -v "CPY OBJ('$i') TODIR('/usr/include/') TOCCSID(*STDASCII) DTAFMT(*TEXT) REPLACE(*YES)"
|
202
|
+
done
|
203
|
+
2) Create sqlcli1.h to match LUW compiles
|
204
|
+
/usr/include/sqlcli1.h
|
205
|
+
#ifndef SQL_H_SQLCLI1
|
206
|
+
#include "sqlcli.h";
|
207
|
+
#endif
|
208
|
+
3) gem install ./ibm_db-n.n.n.gem
|
209
|
+
|
210
|
+
==================
|
211
|
+
2-tier compile consistent with IBM i PASE on LUW (optional)
|
212
|
+
==================
|
213
|
+
For a consistent utf-8 environment LUW<>IBM i, please set following env var ...
|
214
|
+
export IBM_DB_UTF8=yes
|
215
|
+
gem install ./ibm_db-n.n.n.gem
|
216
|
+
- Forces LUW compile to use traditional CLI APIs with utf-8,
|
217
|
+
bypassing utf-16 wide CLI APIs (matching PASE utf-8).
|
218
|
+
- utf-8 provides a consistent IBM i business model ruby script
|
219
|
+
edit, run, debug and deploy using combination of 1-tier and 2-tier
|
220
|
+
|
221
|
+
|
222
|
+
==================
|
223
|
+
LUW operational help
|
224
|
+
==================
|
225
|
+
export PATH=/opt/ibm/db2/V10.5/bin:$PATH
|
226
|
+
export IBM_DB_HOME=/home/db2inst1/sqllib
|
227
|
+
|
228
|
+
$ sudo cp /opt/IBM/db2/V10.5/cfg/db2cli.ini.sample /home/db2inst1/sqllib/cfg/db2cli.ini
|
229
|
+
$ sudo chmod +w /home/db2inst1/sqllib/cfg/db2cli.ini
|
230
|
+
$ sudo e /home/db2inst1/sqllib/cfg/db2cli.ini &
|
231
|
+
; Comment lines start with a semi-colon.
|
232
|
+
; Database name can be found WRKRDBDIRE
|
233
|
+
[LP0364D]
|
234
|
+
Database=LP0364D
|
235
|
+
Protocol=tcpip
|
236
|
+
Hostname=lp0364d.rch.stglabs.ibm.com
|
237
|
+
Servicename=446
|
238
|
+
SchemaList=”*USRLIBL”
|
239
|
+
|
240
|
+
================
|
241
|
+
Ruby threads with DB2
|
242
|
+
================
|
243
|
+
PASE ibm_db automatically enters server mode for thread saftey, which
|
244
|
+
simply means attach a pooled QSQSRVR job to each thread connection.
|
245
|
+
-> ruby-thread-1 IBM::connect('*LOCAL','FRED','PWD') -> QSQSRVR-job-1
|
246
|
+
-> ruby-thread-2 IBM::connect('*LOCAL','TONY','PWD') -> QSQSRVR-job-2
|
247
|
+
-> ... and so on ...
|
248
|
+
Golden Rule:
|
249
|
+
Do NOT share a connection across ruby threads.
|
250
|
+
|
251
|
+
==================
|
252
|
+
ext - ibm_db.so internal notes
|
253
|
+
==================
|
254
|
+
PASE changes tested are UNICODE_SUPPORT_VERSION ...
|
255
|
+
YES - ruby 2.0 path UNICODE_SUPPORT_VERSION (default)
|
256
|
+
YES - ruby 1.9 path UNICODE_SUPPORT_VERSION (default)
|
257
|
+
NO - ruby 1.8 no IBM i team effort made (1.8 retired by ruby)
|
258
|
+
|
259
|
+
PASE chooses not support CLI wide interfaces (UTF-16) ...
|
260
|
+
- PASE is using UTF8_OVERRIDE and SQLOverrideCCSID400 with CCSID 1208.
|
261
|
+
UTF-8 (1208) is asserted "good enough" for
|
262
|
+
world wide business, fitting PASE tooling.
|
263
|
+
- PASE overrides various ibm_db _to_utf16 to implement UTF-8 (name remains utf16)
|
264
|
+
- UTF8_OVERRIDE redefines all CLI wide APIs (see below),
|
265
|
+
because wide interfaces are not required UTF-8 ...
|
266
|
+
undef SQLWCHAR
|
267
|
+
define SQLWCHAR SQLCHAR
|
268
|
+
undef SQL_C_WCHAR
|
269
|
+
define SQL_C_WCHAR SQL_C_CHAR
|
270
|
+
|
271
|
+
SQLOverrideCCSID400 using 1208 ...
|
272
|
+
- CCSID 1208 will allow libdb400.a to simply pass
|
273
|
+
UTF-8 data directly "untouched" to DB2 (ILE code).
|
274
|
+
- ANY other CCSID setting will result in iconv conversion
|
275
|
+
(not very good conversion for literals SQL statements)
|
276
|
+
- libdb400.a 1208 forces ...
|
277
|
+
paseCCSID = 1208;
|
278
|
+
UTF8Value = SQL_TRUE;
|
279
|
+
SQLSetEnvAttr(*ohnd,SQL_ATTR_PASE_CCSID,(SQLPOINTER)&paseCCSID,sizeof(paseCCSID));
|
280
|
+
SQLSetEnvAttr(*ohenv,SQL_ATTR_UTF8,(SQLPOINTER)&UTF8Value,sizeof(UTF8Value));
|
281
|
+
|
282
|
+
PASE code allows both sql/system naming ...
|
283
|
+
- sql naming is schema.table (default)
|
284
|
+
IBM_DB::SQL_ATTR_DBC_SYS_NAMING=>IBM_DB::SQL_NAMING_OFF
|
285
|
+
LIBL/CURLIB will be ignored unqualified resolves, instead
|
286
|
+
a single library will be used (match connect userid),
|
287
|
+
but may be specified using
|
288
|
+
IBM_DB::SQL_ATTR_DBC_DEFAULT_LIB=>"MYLIB"
|
289
|
+
- system naming is lib/file.mbr
|
290
|
+
IBM_DB::SQL_ATTR_DBC_SYS_NAMING=>IBM_DB::SQL_NAMING_ON
|
291
|
+
allows for LIBL/CURLIB style unqualified resolves,
|
292
|
+
LIBL/CURLIB may be specified using ...
|
293
|
+
1) LIBL - IBM_DB::SQL_ATTR_DBC_LIBL=>"DB2 QTEMP QGPL"
|
294
|
+
2) CURLIB - IBM_DB::SQL_ATTR_DBC_CURLIB=>"DB2"
|
295
|
+
V7 system naming supports BOTH ...
|
296
|
+
1) system naming syntax (lib/file.mbr)
|
297
|
+
2) sql naming syntax (schema.table)
|
298
|
+
BUT does NOT work prior V7 without V6 PTFs,
|
299
|
+
and completely forbidden V5 below (move off V5R4)
|
300
|
+
|
301
|
+
PASE added many IBM i attribute settings (below),
|
302
|
+
also work with LUW DB2 Connect 10.5 enhancements.
|
303
|
+
|
304
|
+
== mandatory parameters
|
305
|
+
:adapter 'ibm_db' - DB2 driver
|
306
|
+
:database '*LOCAL', 'LP0364D', ... - IBM i see WRKRDBDIRE
|
307
|
+
:username 'FRED', 'BOB', ... - profile name
|
308
|
+
:password 'MYPASS', 'SHHHME', ... - profile password
|
309
|
+
== remote TCP/IP connection when no local database (unused on IBM i)
|
310
|
+
:host 'socrates','9.5.158.88', ... - fully qualified hostname or IP address
|
311
|
+
:port '446','448', ... - data server TCP/IP port number
|
312
|
+
:security 'SSL' - optional parameter enabling SSL encryption
|
313
|
+
:authentication 'SERVER' - AUTHENTICATION type which the client uses
|
314
|
+
:timeout 0 - 32767 - time in seconds wait reply server
|
315
|
+
== optional (highly recommended for data server auditing and monitoring purposes)
|
316
|
+
:schema "SET SCHEMA #{schema}" - schema.table ('rails123')
|
317
|
+
:app_user IBM_DB::SQL_ATTR_INFO_USERID - connection's user info ('test11')
|
318
|
+
:account IBM_DB::SQL_ATTR_INFO_ACCTSTR - connection's account info ('tester')
|
319
|
+
:application IBM_DB::SQL_ATTR_INFO_APPLNAME - connection's application info ('rtests')
|
320
|
+
:workstation IBM_DB::SQL_ATTR_INFO_WRKSTNNAME - connection's workstation info ('plato')
|
321
|
+
== Parameterized Queries Support
|
322
|
+
:parameterized prepared statement support of IBM_DB Adapter on/off
|
323
|
+
== IBM i connection attributes
|
324
|
+
:ibm_i_naming IBM_DB::SQL_ATTR_DBC_SYS_NAMING - connection's i5 naming mode
|
325
|
+
=>"system" =>IBM_DB::SQL_SYSTEM_NAMING_ON - lib/file.mbr - system naming
|
326
|
+
=>"sql" =>IBM_DB::SQL_SYSTEM_NAMING_OFF - schema.table - sql naming (default)
|
327
|
+
:ibm_i_libl IBM_DB::SQL_ATTR_DBC_LIBL - connection's i5 *LIBL (system naming)
|
328
|
+
:ibm_i_curlib IBM_DB::SQL_ATTR_DBC_CURLIB - connection's i5 CURLIB (system naming)
|
329
|
+
:ibm_i_lib IBM_DB::SQL_ATTR_DBC_DEFAULT_LIB - connection's i5 default lib (sql naming)
|
330
|
+
:ibm_i_sort_seq IBM_DB::SQL_ATTR_CONN_SORT_SEQUENCE- connection's i5 sort sequence
|
331
|
+
=>"job" =>IBM_DB::SQL_JOB_SORT_ON - job attribute sort order
|
332
|
+
=>"system" =>IBM_DB::SQL_JOB_SORT_OFF - system attribute sort (hex)
|
333
|
+
:ibm_i_isolation IBM_DB::SQL_ATTR_TXN_ISOLATION - connection's i5 isolation level
|
334
|
+
=>"none" =>IBM_DB::SQL_TXN_NO_COMMIT - isolation none
|
335
|
+
=>IBM_DB::SQL_COMMIT_NONE - alias NO_COMMIT
|
336
|
+
=>IBM_DB::SQL_TXN_NOCOMMIT - alias NO_COMMIT
|
337
|
+
=>"ur" =>IBM_DB::SQL_TXN_READ_UNCOMMITTED - isolation read uncommitted
|
338
|
+
=>IBM_DB::SQL_COMMIT_CHG - alias READ_UNCOMMITTED
|
339
|
+
=>IBM_DB::SQL_COMMIT_UR - alias READ_UNCOMMITTED
|
340
|
+
=>"cs" =>IBM_DB::SQL_TXN_READ_COMMITTED - isolation read committed
|
341
|
+
=>IBM_DB::SQL_COMMIT_CS - alias READ_COMMITTED
|
342
|
+
=>"rs" =>IBM_DB::SQL_TXN_REPEATABLE_READ - isolation repeatable read
|
343
|
+
=>IBM_DB::SQL_COMMIT_ALL - alias REPEATABLE_READ
|
344
|
+
=>IBM_DB::SQL_COMMIT_RS - alias REPEATABLE_READ
|
345
|
+
=>"rr" =>IBM_DB::SQL_TXN_SERIALIZABLE - isolation serializable
|
346
|
+
=>IBM_DB::SQL_COMMIT_RR - alias SERIALIZABLE
|
347
|
+
:ibm_i_date_fmt IBM_DB::SQL_ATTR_DATE_FMT - connection's i5 date format
|
348
|
+
=>"iso" =>IBM_DB::SQL_FMT_ISO
|
349
|
+
=>"usa" =>IBM_DB::SQL_FMT_USA
|
350
|
+
=>"eur" =>IBM_DB::SQL_FMT_EUR
|
351
|
+
=>"jis" =>IBM_DB::SQL_FMT_JIS
|
352
|
+
=>"dmy" =>IBM_DB::SQL_FMT_DMY
|
353
|
+
=>"mdy" =>IBM_DB::SQL_FMT_MDY
|
354
|
+
=>"ymd" =>IBM_DB::SQL_FMT_YMD
|
355
|
+
=>"jul" =>IBM_DB::SQL_FMT_JUL
|
356
|
+
=>"job" =>IBM_DB::SQL_FMT_JOB
|
357
|
+
:ibm_i_time_fmt IBM_DB::SQL_ATTR_TIME_FMT - connection's i5 time format
|
358
|
+
=>"iso" =>IBM_DB::SQL_FMT_ISO
|
359
|
+
=>"usa" =>IBM_DB::SQL_FMT_USA
|
360
|
+
=>"eur" =>IBM_DB::SQL_FMT_EUR
|
361
|
+
=>"jis" =>IBM_DB::SQL_FMT_JIS
|
362
|
+
=>"hms" =>IBM_DB::SQL_FMT_HMS
|
363
|
+
:ibm_i_date_sep IBM_DB::SQL_ATTR_DATE_FMT - connection's i5 date seperator
|
364
|
+
=>"slash" =>IBM_DB::SQL_SEP_SLASH
|
365
|
+
=>"dash" =>IBM_DB::SQL_SEP_DASH
|
366
|
+
=>"period" =>IBM_DB::SQL_SEP_PERIOD
|
367
|
+
=>"comma" =>IBM_DB::SQL_SEP_COMMA
|
368
|
+
=>"blank" =>IBM_DB::SQL_SEP_BLANK
|
369
|
+
=>"job" =>IBM_DB::SQL_SEP_JOB
|
370
|
+
:ibm_i_time_sep IBM_DB::SQL_ATTR_TIME_FMT - connection's i5 time seperator
|
371
|
+
=>"colon" =>IBM_DB::SQL_SEP_COLON
|
372
|
+
=>"period" =>IBM_DB::SQL_SEP_PERIOD
|
373
|
+
=>"comma" =>IBM_DB::SQL_SEP_COMMA
|
374
|
+
=>"blank" =>IBM_DB::SQL_SEP_BLANK
|
375
|
+
=>"job" =>IBM_DB::SQL_SEP_JOB
|
376
|
+
:ibm_i_decimal_sep IBM_DB::SQL_ATTR_DECIMAL_SEP - connection's i5 decimal seperator
|
377
|
+
=>"period" =>IBM_DB::SQL_SEP_PERIOD
|
378
|
+
=>"comma" =>IBM_DB::SQL_SEP_COMMA
|
379
|
+
=>"job" =>IBM_DB::SQL_SEP_JOB
|
380
|
+
:ibm_i_query_goal IBM_DB::SQL_ATTR_QUERY_OPTIMIZE_GOAL- connection's i5 query optimize goal
|
381
|
+
"first" =>IBM_DB::SQL_FIRST_IO - queries optimized goal first page
|
382
|
+
"all" =>IBM_DB::SQL_ALL_IO - queries optimized goal entire query (default)
|
383
|
+
:ibm_i_dump_savf - task_structure_dump perform SAVLIB
|
384
|
+
true
|
385
|
+
false
|
386
|
+
|
387
|
+
== for testing ... YAML.load
|
388
|
+
ActiveRecord::Base.establish_connection(
|
389
|
+
:adapter => "ibm_db",
|
390
|
+
:yaml => "path/auth.yaml",
|
391
|
+
:level => "development"
|
392
|
+
)
|
393
|
+
path/auth.yaml:
|
394
|
+
development:
|
395
|
+
adapter: ibm_db
|
396
|
+
database: LP0364D
|
397
|
+
username: DB2
|
398
|
+
password: NICEPASS
|
399
|
+
ibm_i_naming: system
|
400
|
+
ibm_i_libl: FRED QTEMP
|
401
|
+
ibm_i_curlib: FRED
|
402
|
+
production:
|
403
|
+
adapter: ibm_db
|
404
|
+
database: LP0364D
|
405
|
+
username: DB2
|
406
|
+
password: NICEPASS
|
407
|
+
ibm_i_naming: system
|
408
|
+
ibm_i_libl: BOB QTEMP
|
409
|
+
ibm_i_curlib: BOB
|
410
|
+
|
411
|
+
|
412
|
+
PASE is using server mode SQL_ATTR_SERVER_MODE (QSQSRVR jobs) for thread saftey ...
|
413
|
+
|
414
|
+
IBM_DB::connect:
|
415
|
+
browser/client -->Apache_thread1->socket->
|
416
|
+
->ruby_app1_thread1-->QSQSRVR(profile DB2) ... connection #0
|
417
|
+
ruby_app1_thread2-->QSQSRVR(profile DB2) ... connection #1
|
418
|
+
ruby_app1_thread3-->QSQSRVR(profile SALLY) ... connection #2
|
419
|
+
ruby_app1_thread4-->QSQSRVR(profile BOB) ... connection #3
|
420
|
+
ruby_app1_thread5-->QSQSRVR(profile DB2) ... connection #4
|
421
|
+
|
422
|
+
- PASE libdb400.a does NOT enforce thread safety DB2 CLI APIs (simply a call through to ILE DB2)
|
423
|
+
- ibm_db c-code is hard coded to always use "server mode" surrogate QSQSRVR jobs (SQL_ATTR_SERVER_MODE)
|
424
|
+
- ibm_db full open/close connection aquires a QSQSRVR job each connection (slow connection)
|
425
|
+
- ibm_db will close implicitly on script end (close returns QSQSRVR to pre-start pool)
|
426
|
+
- ibm_db allows many connections per profile/per thread (each connection aquires it's own QSQSSRVR job)
|
427
|
+
- connection/QSQ job limiting is at the script level (ConnectionPool.rb)
|
428
|
+
- QTEMP for DB2 actions is found in the QSQSRVR job (not ruby job)
|
429
|
+
- QPRTJOB added for spool out QSQSRVR jobs due to use profile not owning profile (see QSPRILSP to understand)
|
430
|
+
- do NOT share a single connection across ruby threads
|
431
|
+
- allows for consistent/safe independent transactions IBM_DB::commit(@@conn)
|
432
|
+
which is CLI API SqlEndTran(SQL_HANDLE_DBC , conn, COMMIT, ROLLBACK, etc)
|
433
|
+
- allows other non-thread safe statement level work to be scoped to the connection
|
434
|
+
because it is all running anchored to the surrogate QSQSRVR job (no worries)
|
435
|
+
|
436
|
+
IBM_DB::pconnect:
|
437
|
+
browser/client -->Apache_thread1->socket->
|
438
|
+
->ruby_app1_thread1-->QSQSRVR(profile DB2) ..........> "shared" connection #0 (1-only-1 limited by ibm_db hKey)
|
439
|
+
ruby_app1_thread2-| ConnectionPool.rb waiting for DB2 to finish transaction ... ZZZZZ
|
440
|
+
ruby_app1_thread3-| ConnectionPool.rb waiting for DB2 to finish transaction ... ZZZZZ
|
441
|
+
ruby_app1_thread4-->QSQSRVR(profile SALLY) ........> "shared" connection #1 (1-only-1 limited by ibm_db hKey)
|
442
|
+
ruby_app1_thread5-| ConnectionPool.rb waiting for SALLY to finish transaction ... ZZZZZ
|
443
|
+
|
444
|
+
- PASE libdb400.a does NOT enforce thread safety DB2 CLI APIs (simply a call through to ILE DB2)
|
445
|
+
- ibm_db c-code is hard coded to always use "server mode" surrogate QSQSRVR jobs (SQL_ATTR_SERVER_MODE)
|
446
|
+
- ibm_db persistent/shared/pooled connection aquires a QSQSRVR job only ONCE (1st use)
|
447
|
+
- ibm_db will NEVER close implicitly on script end (QSQSRVR "alive" forever)
|
448
|
+
- ibm_db allows ONE SHARED connection per profile (hash userid+password+"__ibm_db_")
|
449
|
+
- Control of single connection/QSQ job limiting is at the script level (ConnectionPool.rb)
|
450
|
+
- QTEMP for DB2 actions is found in the QSQSRVR job (not ruby job)
|
451
|
+
- QPRTJOB added for spool out QSQSRVR jobs due to use profile not owning profile (see QSPRILSP to understand)
|
452
|
+
- do NOT share a single connection across ruby threads
|
453
|
+
- This design choice suited DB2 LUW (Linux/Unix/Windows), and basically removed customers from
|
454
|
+
understanding the hash key used to achieve ibm_db persistent/pooled connections, in short,
|
455
|
+
user just changed connect(*LOCAL,user,pwd) to pconnect(*LOCAL,user,pwd) and all ran
|
456
|
+
up to 40% faster.
|
457
|
+
|
458
|
+
|