ruby-oci8 2.2.0.2 → 2.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +1 -6
  3. data/ChangeLog +600 -0
  4. data/NEWS +426 -35
  5. data/README.md +27 -9
  6. data/dist-files +13 -2
  7. data/docs/bind-array-to-in_cond.md +38 -0
  8. data/docs/conflicts-local-connections-and-processes.md +98 -0
  9. data/docs/hanging-after-inactivity.md +63 -0
  10. data/docs/install-binary-package.md +15 -11
  11. data/docs/install-full-client.md +18 -21
  12. data/docs/install-instant-client.md +45 -27
  13. data/docs/install-on-osx.md +31 -117
  14. data/docs/ldap-auth-and-function-interposition.md +123 -0
  15. data/docs/number-type-mapping.md +79 -0
  16. data/docs/platform-specific-issues.md +17 -50
  17. data/docs/report-installation-issue.md +11 -8
  18. data/docs/timeout-parameters.md +94 -0
  19. data/ext/oci8/apiwrap.c.tmpl +2 -5
  20. data/ext/oci8/apiwrap.rb +6 -1
  21. data/ext/oci8/apiwrap.yml +39 -143
  22. data/ext/oci8/attr.c +4 -2
  23. data/ext/oci8/bind.c +421 -9
  24. data/ext/oci8/connection_pool.c +3 -3
  25. data/ext/oci8/encoding.c +5 -5
  26. data/ext/oci8/env.c +8 -2
  27. data/ext/oci8/error.c +24 -16
  28. data/ext/oci8/extconf.rb +35 -63
  29. data/ext/oci8/hook_funcs.c +274 -61
  30. data/ext/oci8/lob.c +31 -75
  31. data/ext/oci8/metadata.c +8 -6
  32. data/ext/oci8/object.c +119 -29
  33. data/ext/oci8/oci8.c +46 -133
  34. data/ext/oci8/oci8.h +40 -123
  35. data/ext/oci8/oci8lib.c +178 -46
  36. data/ext/oci8/ocihandle.c +37 -37
  37. data/ext/oci8/ocinumber.c +24 -35
  38. data/ext/oci8/oraconf.rb +168 -337
  39. data/ext/oci8/oradate.c +19 -19
  40. data/ext/oci8/plthook.h +10 -0
  41. data/ext/oci8/plthook_elf.c +433 -268
  42. data/ext/oci8/plthook_osx.c +40 -9
  43. data/ext/oci8/plthook_win32.c +16 -1
  44. data/ext/oci8/stmt.c +52 -17
  45. data/ext/oci8/win32.c +4 -22
  46. data/lib/oci8/bindtype.rb +10 -17
  47. data/lib/oci8/check_load_error.rb +57 -10
  48. data/lib/oci8/compat.rb +5 -1
  49. data/lib/oci8/connection_pool.rb +74 -3
  50. data/lib/oci8/cursor.rb +70 -31
  51. data/lib/oci8/metadata.rb +9 -1
  52. data/lib/oci8/object.rb +14 -1
  53. data/lib/oci8/oci8.rb +184 -58
  54. data/lib/oci8/ocihandle.rb +0 -16
  55. data/lib/oci8/oracle_version.rb +11 -1
  56. data/lib/oci8/properties.rb +55 -0
  57. data/lib/oci8/version.rb +1 -1
  58. data/lib/oci8.rb +48 -4
  59. data/lib/ruby-oci8.rb +1 -0
  60. data/pre-distclean.rb +1 -3
  61. data/ruby-oci8.gemspec +4 -9
  62. data/setup.rb +11 -2
  63. data/test/README.md +37 -0
  64. data/test/config.rb +8 -1
  65. data/test/setup_test_object.sql +42 -14
  66. data/test/setup_test_package.sql +59 -0
  67. data/test/test_all.rb +4 -0
  68. data/test/test_bind_array.rb +70 -0
  69. data/test/test_bind_boolean.rb +99 -0
  70. data/test/test_bind_integer.rb +47 -0
  71. data/test/test_break.rb +11 -9
  72. data/test/test_clob.rb +5 -17
  73. data/test/test_connstr.rb +142 -0
  74. data/test/test_datetime.rb +8 -3
  75. data/test/test_metadata.rb +2 -1
  76. data/test/test_object.rb +99 -18
  77. data/test/test_oci8.rb +170 -46
  78. data/test/test_oranumber.rb +12 -6
  79. data/test/test_package_type.rb +17 -3
  80. data/test/test_properties.rb +17 -0
  81. metadata +45 -55
  82. data/docs/osx-install-dev-tools.png +0 -0
  83. data/test/README +0 -42
@@ -0,0 +1,38 @@
1
+ # @title Bind an Array to IN-condition
2
+
3
+ Bind an Array to IN-condition
4
+ =============================
5
+
6
+ Binding an arbitrary-length array to IN-condition is not simple.
7
+ You need to create an SQL statement containing a comma-separated
8
+ list whose length is same with the input data.
9
+
10
+ Example:
11
+
12
+ ids = [ ... ] # an arbitrary-length array containing user IDs.
13
+
14
+ place_holder_string = Array.new(ids.length) {|index| ":id_#{index}"}.join(', ')
15
+ # place_holder_string is:
16
+ # ":id_0" if ids.length == 1
17
+ # ":id_0, :id_1" if ids.length == 2
18
+ # ...
19
+ cursor = conn.parse("select * from users where id in (#{place_holder_string})")
20
+ ids.each_with_index do |id, index|
21
+ cursor.bind_param("id#{index}", id) # bind each element
22
+ end
23
+ cursor.exec()
24
+
25
+ However this is awkward. So {OCI8.in_cond} was added in ruby-oci8 2.2.2.
26
+ The above code is rewritten as follows:
27
+
28
+ ids = [ ... ] # an arbitrary-length array containing user IDs.
29
+
30
+ in_cond = OCI8::in_cond(:id, ids)
31
+ cursor = conn.exec("select * from users where id in (#{in_cond.names})", *in_cond.values)
32
+
33
+ or
34
+
35
+ ids = [ ... ] # an arbitrary-length array containing user IDs.
36
+
37
+ in_cond = OCI8::in_cond(:id, ids, Integer) # set the data type explicitly
38
+ cursor = conn.exec("select * from users where id in (#{in_cond.names})", *in_cond.values)
@@ -0,0 +1,98 @@
1
+ # @title Conflicts between Local Connections and Child Process Handling on Unix
2
+
3
+ Conflicts between Local Connections and Child Process Handling on Unix
4
+ ======================================================================
5
+
6
+ Background
7
+ ----------
8
+
9
+ When a local (not-TCP) Oracle connection is established on Unix,
10
+ Oracle client library changes signal handlers in the process to reap
11
+ all dead child processes. However it conflicts with child process
12
+ handling in ruby.
13
+
14
+ Problem 1: It trashes child process handling of Open3::popen.
15
+ ----------
16
+
17
+ require 'oci8'
18
+ require 'open3'
19
+
20
+ Open3::popen3('true') do |i, o, e, w|
21
+ p w.value
22
+ end
23
+
24
+ conn = OCI8.new(username, password)
25
+ puts "establish a local connection"
26
+
27
+ Open3::popen3('true') do |i, o, e, w|
28
+ p w.value
29
+ end
30
+
31
+ The above code outputs the following result:
32
+
33
+ #<Process::Status: pid 19236 exit 0>
34
+ establish a local connection
35
+ nil
36
+
37
+ `w.value` after a local connection doesn't work because Oracle reaps
38
+ the child process on the process termination before ruby detects it.
39
+
40
+ Problem 2: It creates defunct processes after disconnection if signal handlers are reset.
41
+ ----------
42
+
43
+ The `system` function overwrites signal handlers.
44
+ It fixes the problem 1 as follows.
45
+
46
+ require 'oci8'
47
+ require 'open3'
48
+
49
+ Open3::popen3('true') do |i, o, e, w|
50
+ p w.value
51
+ end
52
+
53
+ conn = OCI8.new(username, password) # Signal handlers are changed here.
54
+ puts "establish a local connection"
55
+ system('true') # Signal handlers are reset here.
56
+
57
+ Open3::popen3('true') do |i, o, e, w|
58
+ p w.value
59
+ end
60
+
61
+ The above code outputs the following result:
62
+
63
+ #<Process::Status: pid 19652 exit 0>
64
+ establish a local connection
65
+ #<Process::Status: pid 19656 exit 0>
66
+
67
+ `w.value` after a local connection works.
68
+
69
+ However it makes another problem.
70
+
71
+ require 'oci8'
72
+
73
+ conn = OCI8.new(username, password) # Signal handlers are changed here.
74
+ # An Oracle server process is created here.
75
+ puts "establish a local connection"
76
+ system('true') # Signal handlers are reset here.
77
+
78
+ conn.logoff # The Oracle server process exits and become defunct.
79
+
80
+ # ... do other stuffs...
81
+
82
+ If a program repeatedly creates a local connection and disconnects it,
83
+ the number of defunct processes increases gradually.
84
+
85
+ Solution: BEQUEATH_DETACH=YES
86
+ ----------
87
+
88
+ By setting [BEQUEATH_DETACH=YES][] in `sqlnet.ora`, Oracle client library
89
+ doesn't change signal handlers. The above two problems are fixed.
90
+
91
+ Oracle client library reads `sqlnet.ora` in the following locations:
92
+
93
+ * `$TNS_ADMIN/sqlnet.ora` if the environment variable `TNS_ADMIN`
94
+ is set and `$TNS_ADMIN/sqlnet.ora` exists.
95
+ Otherwise, `$ORACLE_HOME/network/admin/sqlnet.ora`.
96
+ * `$HOME/.sqlnet.ora`
97
+
98
+ [BEQUEATH_DETACH=YES]: https://docs.oracle.com/database/121/NETRF/sqlnet.htm#NETRF183
@@ -0,0 +1,63 @@
1
+ # @title Hanging After a Long Period of Inactivity
2
+
3
+ Hanging After a Long Period of Inactivity
4
+ =========================================
5
+
6
+ When a database connection hangs after a long period of inactivity,
7
+ this document may help you.
8
+
9
+ When a firewall or a NAT proxy resides between Oracle database server
10
+ and client, it sometimes drops inactive connections as dead ones. If a
11
+ client connects to an Oracle server and tries to use the connection
12
+ after a long sleep (> 1 hour), the client may hang in an effort to use the
13
+ dropped connection. This issue will be solved by setting TCP keepalive
14
+ packets whose keepalive time parameter is smaller than the inactive
15
+ connection timeout.
16
+
17
+ TCP keepalive is enabled by [(ENABLE=broken)][] in a connect
18
+ descriptor. If you use easy connect naming such as `//hostname/service_name`,
19
+ ruby-oci8 sets the parameter on behalf of you when the `tcp_keepalive`
20
+ property is set. (This is available since ruby-oci8 2.2.4.)
21
+
22
+ OCI8.properties[:tcp_keepalive] = true
23
+ conn = OCI8.new(username, password, '//hostname/service_name')
24
+
25
+ This is equivalent to the following:
26
+
27
+ connect_descriptor = "(DESCRIPTION=(ENABLE=broken)(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=service_name)))"
28
+ conn = OCI8.new(username, password, connect_descriptor)
29
+
30
+ The default TCP keepalive time is two hours, which may be larger
31
+ than the inactive connection timeout. The default
32
+ value in the system is configurable via [procfs and sysctl on Linux][]
33
+ or [registry parameters on Windows][]. If you have no privilege to
34
+ customize the system, you can change per-connection keepalive time
35
+ by the `tcp_keepalive_time` property.
36
+
37
+ OCI8.properties[:tcp_keepalive_time] = 600 # 10 minutes
38
+
39
+ It is supported on the following platforms since ruby-oci8 2.2.4.
40
+
41
+ * Linux i386 and x86_64
42
+ * macOS
43
+ * Windows x86 and x64
44
+ * Solaris x86_64
45
+
46
+ When it is set on unsupported platforms, you get `NotImplementedError`.
47
+
48
+ This feature is implemented with hackish way. When
49
+ `tcp_keepalive_time` is set, Oracle client library's
50
+ procedure linkage table is modified to intercept [setsockopt][] system
51
+ call. When Oracle client library issues the system call which enables
52
+ TCP keepalive, [ruby-oci8 changes][] the per-connection TCP keepalive time
53
+ immediately.
54
+
55
+ I hope that Oracle adds a new OCI handle attribute to support this
56
+ feature natively in the future.
57
+
58
+ [(ENABLE=broken)]: https://docs.oracle.com/database/121/NETRF/tnsnames.htm#CHDCDGCE
59
+ [procfs and sysctl on Linux]: http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepalive.html
60
+ [registry parameters on Windows]: https://blogs.technet.microsoft.com/nettracer/2010/06/03/things-that-you-may-want-to-know-about-tcp-keepalives/
61
+ [plthook]: https://github.com/kubo/plthook
62
+ [setsockopt]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
63
+ [ruby-oci8 changes]: https://github.com/kubo/ruby-oci8/blob/ruby-oci8-2.2.4/ext/oci8/hook_funcs.c#L302-L318
@@ -1,24 +1,28 @@
1
1
  # @title Install Binary Package
2
2
 
3
- Windows 32-bit (mingw32 ruby)
4
- =============================
3
+ Install Binary Package
4
+ ======================
5
5
 
6
- Run the following command:
6
+ Windows
7
+ -------
7
8
 
8
- gem install ruby-oci8
9
+ You need to install Oracle client in advance.
10
+ If you don't have installed Oracle client, install {file:docs/install-instant-client.md#Install_Oracle_Instant_Client_Packages instant client}. Only the Basic or Basic Lite package is needed to use ruby-oci8.
11
+ However it is better to install SQL*Plus also because it is usable to check whether
12
+ a problem is in Oracle setting or in ruby-oci8.
13
+
14
+ Run the following command to install ruby-oci8.
9
15
 
10
- Windows 32-bit (mswin32 ruby)
11
- =============================
16
+ gem install ruby-oci8
12
17
 
13
- Run the following command:
18
+ If you uses mswin32 ruby, use the following command instead.
14
19
 
15
20
  gem install --platform x86-mingw32 ruby-oci8
16
-
17
- Ruby-oci8 gem for x86-mingw32 works on mswin32 ruby.
18
- If it doesn't work, see {file:docs/install-instant-client.md} or {file:docs/install-full-client.md}.
21
+ or
22
+ gem install --platform x64-mingw32 ruby-oci8
19
23
 
20
24
  Other platforms
21
- ===============
25
+ ---------------
22
26
 
23
27
  We doesn't make binary gems for other platforms.
24
28
  If you need to distribute a binary gem, compile ruby-oci8 and run the following command.
@@ -1,7 +1,10 @@
1
1
  # @title Install for Oracle Full Client
2
2
 
3
+ Install for Oracle Full Client
4
+ ==============================
5
+
3
6
  Introduction
4
- ============
7
+ ------------
5
8
 
6
9
  This page explains the way to install ruby-oci8 for Oracle Full Client
7
10
  installations.
@@ -11,18 +14,16 @@ For Windows, look at {file:docs/install-binary-package.md} unless you
11
14
  have a special need to compile ruby-oci8 by yourself.
12
15
 
13
16
  Check the environment
14
- =====================
17
+ ---------------------
15
18
 
16
- Oracle installation
17
- -------------------
19
+ ### Oracle installation
18
20
 
19
21
  Run the following command and confirm it works fine. If it doesn't
20
22
  work well, you need to ask to your database administrator.
21
23
 
22
24
  sqlplus USERNAME/PASSWORD
23
25
 
24
- ruby installation
25
- -----------------
26
+ ### ruby installation
26
27
 
27
28
  Run the following command. If it ends with "can't find header files
28
29
  for ruby" or "ruby: no such file to load -- mkmf (LoadError)", you need
@@ -30,8 +31,7 @@ to install ruby-devel(redhat) or ruby-dev(debian/ubuntu).
30
31
 
31
32
  ruby -r mkmf -e ""
32
33
 
33
- development tools
34
- -----------------
34
+ ### development tools
35
35
 
36
36
  You need a C compiler and development tools such as make or nmake.
37
37
  Note that they must be same with ones used to compile the ruby.
@@ -39,15 +39,14 @@ For example, you need Oracle Solaris Studio, not gcc, for ruby
39
39
  compiled by Oracle Solaris Studio.
40
40
 
41
41
  Installation
42
- ============
42
+ ------------
43
43
 
44
44
  If you get a problem in the following steps, look at {file:docs/platform-specific-issues.md}
45
45
  and {file:docs/report-installation-issue.md}.
46
46
 
47
- Set the library search path
48
- ---------------------------
47
+ ### Set the library search path
49
48
 
50
- ### UNIX
49
+ #### UNIX
51
50
 
52
51
  Set the library search path, whose name depends on the OS, to point to
53
52
  $ORACLE\_HOME/lib. If the database is 64-bit and the ruby is 32-bit,
@@ -74,27 +73,25 @@ Do not forget to export the variable as follows:
74
73
  $ LD_LIBRARY_PATH=$ORACLE_HOME/lib
75
74
  $ export LD_LIBRARY_PATH
76
75
 
77
- ### Windows(mswin32, mingw32, cygwin)
76
+ #### Windows(mswin32, mingw32, cygwin)
78
77
 
79
78
  If sqlplus runs correctly, library search path has no problem.
80
79
 
81
- gem package
82
- -----------
80
+ ### gem package
83
81
 
84
82
  Run the following command.
85
83
 
86
84
  gem install ruby-oci8
87
85
 
88
- tar.gz package
89
- --------------
86
+ ### tar.gz package
90
87
 
91
- ### Download the source code
88
+ #### Download the source code
92
89
 
93
90
  Download the latest tar.gz package from [download page][].
94
91
 
95
- ### Run make and install
92
+ #### Run make and install
96
93
 
97
- #### UNIX or Windows(mingw32, cygwin)
94
+ ##### UNIX or Windows(mingw32, cygwin)
98
95
 
99
96
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
100
97
  cd ruby-oci8-VERSION
@@ -104,7 +101,7 @@ Download the latest tar.gz package from [download page][].
104
101
  note: If you use '`sudo`', use it only when running '`make install`'.
105
102
  '`sudo`' doesn't pass library search path to the executing command for security reasons.
106
103
 
107
- #### Windows(mswin32)
104
+ ##### Windows(mswin32)
108
105
 
109
106
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
110
107
  cd ruby-oci8-VERSION
@@ -1,7 +1,10 @@
1
1
  # @title Install for Oracle Instant Client
2
2
 
3
+ Install for Oracle Instant Client
4
+ =================================
5
+
3
6
  Introduction
4
- ============
7
+ ------------
5
8
 
6
9
  This page explains the way to install ruby-oci8 for Oracle Instant Client.
7
10
 
@@ -13,10 +16,10 @@ have a special need to compile ruby-oci8 by yourself.
13
16
  Look at {file:docs/install-on-osx.md} for OS X.
14
17
 
15
18
  Install Oracle Instant Client Packages
16
- ======================================
19
+ --------------------------------------
20
+
21
+ ### Download Instant Client Packages
17
22
 
18
- Donwload Instant Client Packages
19
- --------------------------------
20
23
  Download the following packages from [Oracle Technology Network](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html).
21
24
 
22
25
  * Instant Client Package - Basic or Basic Lite
@@ -25,8 +28,7 @@ Download the following packages from [Oracle Technology Network](http://www.orac
25
28
 
26
29
  Note: use 32-bit packages for 32-bit ruby even though the OS is 64-bit.
27
30
 
28
- UNIX zip packages
29
- -----------------
31
+ ### UNIX zip packages
30
32
 
31
33
  Unzip the packages as follows:
32
34
 
@@ -79,8 +81,7 @@ Though many instant client pages indicate that the environment varialbe
79
81
  configuration files such as `tnsnames.ora` and `sqlnet.ora` are in
80
82
  `$ORACLE_HOME/network/admin/`.
81
83
 
82
- Linux rpm packages
83
- ------------------
84
+ ### Linux rpm packages
84
85
 
85
86
  Install the downloaded packages as follows:
86
87
 
@@ -95,24 +96,44 @@ For example:
95
96
  $ LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client/lib
96
97
  $ export LD_LIBRARY_PATH
97
98
 
98
- Windows
99
- -------
99
+ ### Windows
100
+
101
+ Unzip the packages and set `PATH` to point to the directory where `OCI.DLL` is installed.
102
+
103
+ If `require "ruby-oci8"` raises a load error such as "OCI.DLL: 126(The
104
+ specified module could not be found. )", either `OCI.DLL` or a DLL depended
105
+ by `OCI.DLL` could not be found in `PATH`.
106
+
107
+ If `OCI.DLL` is surely in `PATH`, the missing module is a Visual C++ runtime
108
+ library in most cases. You need to install "Microsoft Visual C++ Redistributable
109
+ Package" or copy a runtime library to the directory where `ruby.exe` resides.
110
+
111
+ | Oracle Version | Package | Runtime Library|
112
+ |---|---|---|
113
+ | 18.3 | [Microsoft Visual C++ 2013 Redistributable Package][2013] | MSVCR120.DLL |
114
+ | 12.2.0.x | [Microsoft Visual C++ 2013 Redistributable Package][2013] | MSVCR120.DLL |
115
+ | 12.1.0.x | [Microsoft Visual C++ 2010 Redistributable Package][2010] | MSVCR100.DLL |
116
+ | 11.2.0.x | Microsoft Visual C++ 2005 SP1 Redistributable Package ([x86][2005SP1_x86], [x64][2005SP1_x64]) | MSVCR80.DLL(The file version must be 8.0.50727.762.) |
117
+ | 11.1.0.x | [No separate redistributable package][2003] | MSVCR71.DLL |
118
+ | 10.2.0.x | [No separate redistributable package][2003] | MSVCR71.DLL |
100
119
 
101
- Unzip the packages and set PATH to point to the directory where OCI.DLL is installed.
120
+ [2013]: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
121
+ [2010]: http://www.microsoft.com/en-us/download/details.aspx?id=26999
122
+ [2005SP1_x86]: https://www.microsoft.com/en-us/download/details.aspx?id=5638
123
+ [2005SP1_x64]: https://www.microsoft.com/en-us/download/details.aspx?id=18471
124
+ [2003]: http://stackoverflow.com/questions/1596167/where-to-download-microsoft-visual-c-2003-redistributable#6132093
102
125
 
103
126
  Check the environment
104
- =====================
127
+ ---------------------
105
128
 
106
- Oracle installation
107
- -------------------
129
+ ### Oracle installation
108
130
 
109
131
  Run the following command and confirm it works fine. If it doesn't
110
132
  work well, check `LD_LIBRARY_PATH` or PATH.
111
133
 
112
134
  sqlplus USERNAME/PASSWORD
113
135
 
114
- ruby installation
115
- -----------------
136
+ ### ruby installation
116
137
 
117
138
  Run the following command. If it ends with "can't find header files
118
139
  for ruby" or "ruby: no such file to load -- mkmf (LoadError)", you need
@@ -120,8 +141,7 @@ to install ruby-devel(redhat) or ruby-dev(debian/ubuntu).
120
141
 
121
142
  ruby -r mkmf -e ""
122
143
 
123
- development tools
124
- -----------------
144
+ ### development tools
125
145
 
126
146
  You need a C compiler and development tools such as make or nmake.
127
147
  Note that they must be same with ones used to compile the ruby.
@@ -129,13 +149,12 @@ For example, you need Oracle Solaris Studio, not gcc, for ruby
129
149
  compiled by Oracle Solaris Studio.
130
150
 
131
151
  Installation
132
- ============
152
+ ------------
133
153
 
134
154
  If you get a problem in the following steps, look at {file:docs/platform-specific-issues.md}
135
155
  and {file:docs/report-installation-issue.md}.
136
156
 
137
- gem package
138
- -----------
157
+ ### gem package
139
158
 
140
159
  Run the following command.
141
160
 
@@ -144,19 +163,18 @@ Run the following command.
144
163
  If you get a problem, look at {file:docs/platform-specific-issues.md}
145
164
  and {file:docs/report-installation-issue.md}.
146
165
 
147
- tar.gz package
148
- --------------
166
+ ### tar.gz package
149
167
 
150
- ### Download the source code
168
+ #### Download the source code
151
169
 
152
170
  Download the latest tar.gz package from [download page][].
153
171
 
154
172
  Note: if you are using Windows and you have no special need to compile
155
173
  it by yourself, look at {file:docs/install-binary-packge.md}.
156
174
 
157
- ### Run make and install
175
+ #### Run make and install
158
176
 
159
- #### UNIX or Windows(mingw32, cygwin)
177
+ ##### UNIX or Windows(mingw32, cygwin)
160
178
 
161
179
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
162
180
  cd ruby-oci8-VERSION
@@ -166,7 +184,7 @@ it by yourself, look at {file:docs/install-binary-packge.md}.
166
184
  note: If you use '`sudo`', use it only when running '`make install`'.
167
185
  '`sudo`' doesn't pass library search path to the executing command for security reasons.
168
186
 
169
- #### Windows(mswin32)
187
+ ##### Windows(mswin32)
170
188
 
171
189
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
172
190
  cd ruby-oci8-VERSION
@@ -1,132 +1,46 @@
1
- # @title Install ruby-oci8 on OS X
1
+ # @title Install ruby-oci8 on macOS
2
2
 
3
- This page explains the way to install ruby-oci8 os OS X.
3
+ Install ruby-oci8 on macOS
4
+ =========================
4
5
 
5
- Look at {file:docs/install-full-client.md}, {file:docs/install-instant-client.md}
6
- or {file:docs/install-binary-package.md} for other platforms.
6
+ **Note: Ruby-oci8 doesn't run on Apple Silicon because Oracle instant client
7
+ for Apple Silicon has not been released yet.**
7
8
 
8
- Install C compiler
9
- ==================
9
+ Prerequisite
10
+ ------------
10
11
 
11
- You need to install the command line developer tools or the Xcode.
12
- (The latter includes the former.)
13
-
14
- Run `"cc --version"` in a terminal to check whether they are installed.
15
-
16
- If the cc version is printed, the tools are installed.
17
-
18
- If the follwoing dialog is displayed, click its Install button to
19
- install the tools.
20
- You have no need to install the Xcode to compile ruby-oci8.
21
- It requires command line tools, not an IDE such as the Xcode.
22
-
23
- ![dialog](osx-install-dev-tools.png)
24
-
25
- If `"Agreeing to the Xcode/iOS license requires admin privileges,
26
- please re-run as root via sudo."` is printed, you need to run
27
- `"sudo cc --version"`, enter your password, look at the license
28
- and type `"agree"`.
12
+ * Command line tools for Xcode or Xcode (by executing `xcode-select --install`) or [Xcode]
29
13
 
30
14
  Install Oracle Instant Client Packages
31
- ======================================
32
-
33
- Download Oracle Instant Client Packages
34
- --------------------------------
35
-
36
- Download the following packages from [Oracle Technology Network][]
37
-
38
- * Instant Client Package - Basic or Basic Lite
39
- * Instant Client Package - SDK
40
- * Instant Client Package - SQL*Plus (optionally)
41
-
42
- Install Oracle Instant Client Packages via Homebrew
43
- ---------------------------------------------------
44
-
45
- To install `Oracle Instant Client Basic Lite` via [Homebrew][]
46
-
47
- * Download two instant client packages: `Basic Lite` and `SDK` and put them
48
- in `/Library/Caches/Homebrew` (if the environment variable `HOMEBREW_CACHE`
49
- is not set and `$HOME/Library/Caches/Homebrew` doesn't exist.)
50
- * Run the followining commands:
51
-
52
- brew install InstantClientTap/instantclient/instantclient-basiclite
53
- brew install InstantClientTap/instantclient/instantclient-sdk
54
-
55
- To install `Oracle Instant Client Basic` via [Homebrew][]
56
-
57
- * Download *three* instant client packages: `Basic`, `Basic Lite` and `SDK`
58
- and put them in `/Library/Caches/Homebrew` (if the environment variable
59
- `HOMEBREW_CACHE` is not set and `$HOME/Library/Caches/Homebrew` doesn't exist.)
60
- * Run the followining commands:
61
-
62
- brew install InstantClientTap/instantclient/instantclient-basic
63
- brew install InstantClientTap/instantclient/instantclient-sdk
64
-
65
- * Set the environment variable OCI_DIR while performing the following installation steps
66
- if Homebrew is installed outside `/usr/local`.
67
-
68
- export OCI_DIR=$(brew --prefix)/lib
69
-
70
- Install Oracle Instant Client Manually
71
- ---------------------
72
-
73
- If you don't use [Homebrew][], do the following:
74
-
75
- Unzip the packages as follows:
76
-
77
- mkdir /opt
78
- mkdir /opt/oracle
79
- cd /opt/oracle
80
-
81
- Copy downloaded files to /opt/oracle before running the following commands.
82
-
83
- unzip instantclient-basic-macos.x64-11.2.0.4.0.zip
84
- unzip instantclient-sdk-macos.x64-11.2.0.4.0.zip
85
- unzip instantclient-sqlplus-macos.x64-11.2.0.4.0.zip
86
-
87
- Make a symbolic link to link the library.
88
-
89
- cd /opt/oracle/instantclient11_2
90
- ln -s libclntsh.dylib.11.1 libclntsh.dylib
91
-
92
- Fix the library install and identification names using [fix_oralib][] to make them work
93
- without `DYLD_LIBRARY_PATH`.
94
-
95
- cd /opt/oracle/instantclient11_2
96
- curl -O https://raw.githubusercontent.com/kubo/fix_oralib_osx/master/fix_oralib.rb
97
- ruby fix_oralib.rb
98
-
99
- Set the environment variable OCI_DIR while performing the following installation steps.
100
-
101
- export OCI_DIR=/opt/oracle/instantclient11_2
102
-
103
- Installation
104
- ============
105
-
106
- If you get a problem in the following steps, look at {file:docs/report-installation-issue.md}.
107
-
108
- gem package
109
- -----------
15
+ --------------------------------------
110
16
 
111
- Run the following command.
17
+ If you have installed [Homebrew], use the following command:
112
18
 
113
- gem install ruby-oci8
19
+ ```shell
20
+ $ brew tap InstantClientTap/instantclient
21
+ $ brew install instantclient-basic # or instantclient-basiclite
22
+ $ brew install instantclient-sdk
23
+ $ brew install instantclient-sqlplus # (optionally)
24
+ ```
114
25
 
115
- tar.gz package
116
- --------------
26
+ Otherwise, look at this [page][OTN] and set the environment variable
27
+ `OCI_DIR` to point the the directory where instant client is installed.
28
+ Ruby-oci8 installation script checks the directory.
117
29
 
118
- ### Download the source code
30
+ ```shell
31
+ export OCI_DIR=$HOME/Downloads/instantclient_19_8 # for example
32
+ ```
119
33
 
120
- Download the latest tar.gz package from [download page][].
34
+ Install ruby-oci8
35
+ -----------------
121
36
 
122
- ### Run make and install
37
+ Note that `/usr/bin/ruby` isn't available. You need to use [`rbenv`] or so.
123
38
 
124
- tar xvfz ruby-oci8-VERSION.tar.gz
125
- cd ruby-oci8-VERSION
126
- make
127
- make install
39
+ ```shell
40
+ $ gem install ruby-oci8
41
+ ```
128
42
 
129
- [download page]: https://bintray.com/kubo/generic/ruby-oci8
130
43
  [Homebrew]: http://brew.sh/
131
- [fix_oralib]: https://github.com/kubo/fix_oralib_osx
132
- [Oracle Technology Network]: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
44
+ [OTN]: https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html#ic_osx_inst
45
+ [Xcode]: https://apps.apple.com/us/app/xcode/id497799835
46
+ [`rbenv`]: https://github.com/rbenv/rbenv