ruby-oci8 2.2.3-x86-mingw32 → 2.2.4-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
+ ### Donwload 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,43 @@ 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
+ | 12.2.0.x | [Microsoft Visual C++ 2013 Redistributable Package][2013] | MSVCR120.DLL |
114
+ | 12.1.0.x | [Microsoft Visual C++ 2010 Redistributable Package][2010] | MSVCR100.DLL |
115
+ | 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.) |
116
+ | 11.1.0.x | [No separate redistributable package][2003] | MSVCR71.DLL |
117
+ | 10.2.0.x | [No separate redistributable package][2003] | MSVCR71.DLL |
100
118
 
101
- Unzip the packages and set PATH to point to the directory where OCI.DLL is installed.
119
+ [2013]: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
120
+ [2010]: http://www.microsoft.com/en-us/download/details.aspx?id=26999
121
+ [2005SP1_x86]: https://www.microsoft.com/en-us/download/details.aspx?id=5638
122
+ [2005SP1_x64]: https://www.microsoft.com/en-us/download/details.aspx?id=18471
123
+ [2003]: http://stackoverflow.com/questions/1596167/where-to-download-microsoft-visual-c-2003-redistributable#6132093
102
124
 
103
125
  Check the environment
104
- =====================
126
+ ---------------------
105
127
 
106
- Oracle installation
107
- -------------------
128
+ ### Oracle installation
108
129
 
109
130
  Run the following command and confirm it works fine. If it doesn't
110
131
  work well, check `LD_LIBRARY_PATH` or PATH.
111
132
 
112
133
  sqlplus USERNAME/PASSWORD
113
134
 
114
- ruby installation
115
- -----------------
135
+ ### ruby installation
116
136
 
117
137
  Run the following command. If it ends with "can't find header files
118
138
  for ruby" or "ruby: no such file to load -- mkmf (LoadError)", you need
@@ -120,8 +140,7 @@ to install ruby-devel(redhat) or ruby-dev(debian/ubuntu).
120
140
 
121
141
  ruby -r mkmf -e ""
122
142
 
123
- development tools
124
- -----------------
143
+ ### development tools
125
144
 
126
145
  You need a C compiler and development tools such as make or nmake.
127
146
  Note that they must be same with ones used to compile the ruby.
@@ -129,13 +148,12 @@ For example, you need Oracle Solaris Studio, not gcc, for ruby
129
148
  compiled by Oracle Solaris Studio.
130
149
 
131
150
  Installation
132
- ============
151
+ ------------
133
152
 
134
153
  If you get a problem in the following steps, look at {file:docs/platform-specific-issues.md}
135
154
  and {file:docs/report-installation-issue.md}.
136
155
 
137
- gem package
138
- -----------
156
+ ### gem package
139
157
 
140
158
  Run the following command.
141
159
 
@@ -144,19 +162,18 @@ Run the following command.
144
162
  If you get a problem, look at {file:docs/platform-specific-issues.md}
145
163
  and {file:docs/report-installation-issue.md}.
146
164
 
147
- tar.gz package
148
- --------------
165
+ ### tar.gz package
149
166
 
150
- ### Download the source code
167
+ #### Download the source code
151
168
 
152
169
  Download the latest tar.gz package from [download page][].
153
170
 
154
171
  Note: if you are using Windows and you have no special need to compile
155
172
  it by yourself, look at {file:docs/install-binary-packge.md}.
156
173
 
157
- ### Run make and install
174
+ #### Run make and install
158
175
 
159
- #### UNIX or Windows(mingw32, cygwin)
176
+ ##### UNIX or Windows(mingw32, cygwin)
160
177
 
161
178
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
162
179
  cd ruby-oci8-VERSION
@@ -166,7 +183,7 @@ it by yourself, look at {file:docs/install-binary-packge.md}.
166
183
  note: If you use '`sudo`', use it only when running '`make install`'.
167
184
  '`sudo`' doesn't pass library search path to the executing command for security reasons.
168
185
 
169
- #### Windows(mswin32)
186
+ ##### Windows(mswin32)
170
187
 
171
188
  gzip -dc ruby-oci8-VERSION.tar.gz | tar xvf -
172
189
  cd ruby-oci8-VERSION
@@ -1,12 +1,15 @@
1
1
  # @title Install ruby-oci8 on OS X
2
2
 
3
+ Install ruby-oci8 on OS X
4
+ =========================
5
+
3
6
  This page explains the way to install ruby-oci8 os OS X.
4
7
 
5
8
  Look at {file:docs/install-full-client.md}, {file:docs/install-instant-client.md}
6
9
  or {file:docs/install-binary-package.md} for other platforms.
7
10
 
8
11
  Install C compiler
9
- ==================
12
+ ------------------
10
13
 
11
14
  You need to install the command line developer tools or the Xcode.
12
15
  (The latter includes the former.)
@@ -28,10 +31,9 @@ please re-run as root via sudo."` is printed, you need to run
28
31
  and type `"agree"`.
29
32
 
30
33
  Install Oracle Instant Client Packages
31
- ======================================
34
+ --------------------------------------
32
35
 
33
- Download Oracle Instant Client Packages
34
- --------------------------------
36
+ ### Download Oracle Instant Client Packages
35
37
 
36
38
  Download the following packages from [Oracle Technology Network][]
37
39
 
@@ -39,8 +41,7 @@ Download the following packages from [Oracle Technology Network][]
39
41
  * Instant Client Package - SDK (`instantclient-sdk-macos.x64-12.1.0.2.0.zip`)
40
42
  * Instant Client Package - SQL*Plus (`instantclient-sdk-macos.x64-12.1.0.2.0.zip`) (optionally)
41
43
 
42
- Install Oracle Instant Client Packages via Homebrew
43
- ---------------------------------------------------
44
+ ### Install Oracle Instant Client Packages via Homebrew
44
45
 
45
46
  To install `Oracle Instant Client Basic` via [Homebrew][]
46
47
 
@@ -78,8 +79,7 @@ To install `Oracle Instant Client Basic Lite` via [Homebrew][]
78
79
 
79
80
  export OCI_DIR=$(brew --prefix)/lib
80
81
 
81
- Install Oracle Instant Client Manually
82
- ---------------------
82
+ ### Install Oracle Instant Client Manually
83
83
 
84
84
  If you don't use [Homebrew][], do the following:
85
85
 
@@ -104,25 +104,23 @@ Set the environment variable OCI_DIR while performing the following installation
104
104
  export OCI_DIR=/opt/oracle/instantclient_12_1
105
105
 
106
106
  Installation
107
- ============
107
+ ------------
108
108
 
109
109
  If you get a problem in the following steps, look at {file:docs/report-installation-issue.md}.
110
110
 
111
- gem package
112
- -----------
111
+ ### gem package
113
112
 
114
113
  Run the following command.
115
114
 
116
115
  gem install ruby-oci8
117
116
 
118
- tar.gz package
119
- --------------
117
+ ### tar.gz package
120
118
 
121
- ### Download the source code
119
+ #### Download the source code
122
120
 
123
121
  Download the latest tar.gz package from [download page][].
124
122
 
125
- ### Run make and install
123
+ #### Run make and install
126
124
 
127
125
  tar xvfz ruby-oci8-VERSION.tar.gz
128
126
  cd ruby-oci8-VERSION
@@ -1,10 +1,12 @@
1
1
  # @title Platform Specific Issues
2
2
 
3
+ Platform Specific Issues
4
+ ========================
5
+
3
6
  Linux
4
- =====
7
+ -----
5
8
 
6
- Ubuntu 11.10 (Oneiric Ocelot)
7
- -----------------------------
9
+ ### Ubuntu 11.10 (Oneiric Ocelot)
8
10
 
9
11
  If the following error occurs even though libc6-dev is installed,
10
12
 
@@ -15,8 +17,7 @@ You need to use ruby-oci8 2.1.0 or upper. Otherwise, run the following command a
15
17
 
16
18
  $ sudo ln -s /usr/include/linux/ /usr/include/sys
17
19
 
18
- General Linux
19
- -------------
20
+ ### General Linux
20
21
 
21
22
  Use the same bit-width of libraries with ruby. For example, x86\_64
22
23
  instant client for x86\_64 ruby and 32-bit instant client for 32-bit
@@ -32,21 +33,18 @@ To check which type of ruby do you use:
32
33
  Note: "`" is a back quote.
33
34
 
34
35
  Mac OS X
35
- ========
36
+ --------
36
37
 
37
- OS X 10.7+
38
- ----------
38
+ ### OS X 10.7+
39
39
 
40
40
  Use the latest 64-bit instant client. The older 64-bit (10.2.0.4) instant client [doesn't work](https://forums.oracle.com/forums/thread.jspa?threadID=2187558). The older 32-bit instant client will work but only with 32-bit ruby or jruby (using JDBC).
41
41
 
42
- Intel Mac (64-bit)
43
- ------------------
42
+ ### Intel Mac (64-bit)
44
43
 
45
44
  See [How to setup Ruby and Oracle Instant Client on Snow Leopard](http://blog.rayapps.com/2009/09/06/how-to-setup-ruby-and-oracle-instant-client-on-snow-leopard/).
46
45
  Note that setting the environment variable RC\_ARCHS=x86\_64 instead of ARCHFLAGS="-arch x86\_64" will work fine also.
47
46
 
48
- Intel Mac (32-bit)
49
- ------------------
47
+ ### Intel Mac (32-bit)
50
48
 
51
49
  See [How to setup Ruby and Oracle Instant Client on Snow Leopard](http://blog.rayapps.com/2009/09/06/how-to-setup-ruby-and-oracle-instant-client-on-snow-leopard/). Note that you need to replace x86\_64 with i386 in the blog.
52
50
 
@@ -57,13 +55,12 @@ use one of the following workarounds.
57
55
  * use [ruby-odbc](http://www.ch-werner.de/rubyodbc/) and a third party ODBC driver ([Actual Technologies](http://www.actualtechnologies.com) or [OpenLink Software](http://uda.openlinksw.com/)).
58
56
  * use JRuby and Oracle JDBC driver.
59
57
 
60
- PowerPC Mac
61
- -----------
58
+ ### PowerPC Mac
62
59
 
63
60
  See [How to setup Ruby and Oracle Instant Client on Snow Leopard](http://blog.rayapps.com/2009/09/06/how-to-setup-ruby-and-oracle-instant-client-on-snow-leopard/). Note that you need to replace x86\_64 with ppc in the blog.
64
61
 
65
62
  Solaris
66
- =======
63
+ -------
67
64
 
68
65
  You need a same compiler which is used to make ruby itself.
69
66
  For example, if the ruby is compiled by gcc, you need gcc. If it is compiled by Oracle Solaris Studio
@@ -83,15 +80,10 @@ as follows:
83
80
  to: CONFIG["LDFLAGS"] = "-L. "
84
81
 
85
82
  FreeBSD
86
- =======
87
-
88
- There are two ways.
83
+ -------
89
84
 
90
- * use ruby and instant client on linux emulator
91
- * use oracle8-client port
92
-
93
- linux emulator
94
- --------------
85
+ Oracle8-client port isn't available because it is too old.
86
+ You need to use linux emulator.
95
87
 
96
88
  I have not run ruby-oci8 on linux emulator, but I guess it will
97
89
  run as follows. If it works, please tell me.
@@ -129,33 +121,8 @@ On freebsd:
129
121
  cd /compat/linux/usr/local
130
122
  tar xvfz ruby-1.8.x-linux.tar.gz
131
123
 
132
- oracle8-client port
133
- -------------------
134
-
135
- I don't recommend this because of the following two reasons.
136
-
137
- * The oracle8-client port is made from Oracle 8.1.7.1 static library for Linux. Oracle have not supported the connectivity between 8.1.7.1 and Oracle 10g.
138
- * It is very unstable. When it fails to connect to an Oracle server, it is down by segmentation fault on FreeBSD 7.0 not only when using ruby-oci8, but also by a very simple test code written by C.
139
-
140
- If you try to use oracle8-client port, compile and install as follows.
141
-
142
- * install oracle8-client
143
-
144
- cd /usr/ports/databases/oracle8-client
145
- make
146
- make install
147
-
148
- * set an environment variable ORACLE\_HOME
149
-
150
- export ORACLE_HOME=/usr/local/oracle8-client
151
-
152
- The rest steps are described at {file:docs/install-full-client.md}.
153
-
154
- note: You have no need to set LD\_LIBRARY\_PATH because
155
- Oracle libraries in oracle8-client port are static ones.
156
-
157
124
  HP-UX
158
- =====
125
+ -----
159
126
 
160
127
  You need a ruby which is linked with ''libpthread'' and ''libcl''.
161
128
 
@@ -174,7 +141,7 @@ and `make install`.
174
141
  The rest steps are described at {file:docs/install-full-client.md}.
175
142
 
176
143
  Windows
177
- =======
144
+ -------
178
145
 
179
146
  On some machines using a slow disk, you may get the following error.
180
147
 
@@ -1,5 +1,8 @@
1
1
  # @title Report Installation Issues
2
2
 
3
+ Report Installation Issues
4
+ ==========================
5
+
3
6
  Look at {file:docs/platform-specific-issues.md} and [the issues page on github][github] to check whether your issue is fixed or not.
4
7
 
5
8
  If it is a new one, post the following information to [github][].
@@ -30,6 +30,9 @@ The next two parameters `send_timeout` and `recv_timeout` are available on Oracl
30
30
  or upper. Use these parameters to prevent a ruby process from being blocked by poor quality network.
31
31
  Otherwise, the ruby process may be blocked until TCP keepalive time (2 hours).
32
32
 
33
+ See {file:docs/hanging-after-inactivity.md Hanging After a Long Period of Inactivity}
34
+ for TCP keepalive time.
35
+
33
36
  tcp_connect_timeout
34
37
  -------------------
35
38
 
@@ -1,4 +1,3 @@
1
-
2
1
  # --*- ruby -*--
3
2
  # This is based on yoshidam's oracle.rb.
4
3
  #
@@ -68,12 +67,50 @@ else
68
67
  raise 'unsupported ruby engine: ' + RUBY_ENGINE
69
68
  end
70
69
 
70
+ dll_dir = nil
71
+ begin
72
+ require 'ruby_installer/runtime' # RubyInstaller2 for Windows
73
+
74
+ dll_arch = proc do |file|
75
+ begin
76
+ File.open(file, 'rb') do |f|
77
+ if f.read(2) == 'MZ' # IMAGE_DOS_HEADER.e_magic
78
+ f.seek(60, IO::SEEK_SET)
79
+ pe_offset = f.read(4).unpack('V')[0] # IMAGE_DOS_HEADER.e_lfanew
80
+ f.seek(pe_offset)
81
+ if f.read(4) == "PE\000\000" # IMAGE_NT_HEADERS.Signature
82
+ case f.read(2).unpack('v')[0] # IMAGE_FILE_HEADER.Machine
83
+ when 0x014c # IMAGE_FILE_MACHINE_I386
84
+ :x86
85
+ when 0x8664 # IMAGE_FILE_MACHINE_AMD64
86
+ :x64
87
+ end
88
+ end
89
+ end
90
+ end
91
+ rescue
92
+ nil
93
+ end
94
+ end
95
+
96
+ ruby_arch = [nil].pack('P').size == 8 ? :x64 : :x86
97
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
98
+ if dll_arch.call(File.join(path, 'OCI.DLL')) == ruby_arch
99
+ dll_dir = RubyInstaller::Runtime.add_dll_directory(path)
100
+ break
101
+ end
102
+ end
103
+ rescue LoadError
104
+ end
105
+
71
106
  begin
72
107
  require so_basename
73
108
  rescue LoadError, OCIError
74
109
  require 'oci8/check_load_error'
75
110
  OCI8::Util::check_load_error($!)
76
111
  raise
112
+ ensure
113
+ dll_dir.remove if dll_dir
77
114
  end
78
115
 
79
116
  require 'oci8/version.rb'
@@ -58,15 +58,16 @@ class OCI8
58
58
  # # ...or...
59
59
  # cursor.bind_param(':ename', 'SMITH') # bind by name
60
60
  #
61
- # To bind as number, Fixnum and Float are available, but Bignum is
62
- # not supported. If its initial value is NULL, please set nil to
63
- # +type+ and Fixnum or Float to +val+.
61
+ # To bind as number, set the number intself to +val+. If its initial value
62
+ # is NULL, please set nil to +type+ and Integer, Float or OraNumber to +val+.
64
63
  #
65
64
  # example:
66
- # cursor.bind_param(1, 1234) # bind as Fixnum, Initial value is 1234.
65
+ # cursor.bind_param(1, 1234) # bind as Integer, Initial value is 1234.
67
66
  # cursor.bind_param(1, 1234.0) # bind as Float, Initial value is 1234.0.
68
- # cursor.bind_param(1, nil, Fixnum) # bind as Fixnum, Initial value is NULL.
67
+ # cursor.bind_param(1, nil, Integer) # bind as Integer, Initial value is NULL.
69
68
  # cursor.bind_param(1, nil, Float) # bind as Float, Initial value is NULL.
69
+ # cursor.bind_param(1, OraNumber(1234)) # bind as OraNumber, Initial value is 1234.
70
+ # cursor.bind_param(1, nil, OraNumber) # bind as OraNumber, Initial value is NULL.
70
71
  #
71
72
  # In case of binding a string, set the string itself to
72
73
  # +val+. When the bind variable is used as output, set the
@@ -379,7 +380,7 @@ class OCI8
379
380
  #
380
381
  # FYI: Rails oracle adaptor uses 100 by default.
381
382
  #
382
- # @param [Fixnum] rows The number of rows to be prefetched
383
+ # @param [Integer] rows The number of rows to be prefetched
383
384
  def prefetch_rows=(rows)
384
385
  attr_set_ub4(11, rows) # OCI_ATTR_PREFETCH_ROWS(11)
385
386
  end
@@ -430,12 +431,12 @@ class OCI8
430
431
  # * OCI8::STMT_ALTER
431
432
  # * OCI8::STMT_BEGIN (PL/SQL block which starts with a BEGIN keyword)
432
433
  # * OCI8::STMT_DECLARE (PL/SQL block which starts with a DECLARE keyword)
433
- # * Other Fixnum value undocumented in Oracle manuals.
434
+ # * Other Integer value undocumented in Oracle manuals.
434
435
  #
435
436
  # <em>Changes between ruby-oci8 1.0 and 2.0.</em>
436
437
  #
437
438
  # [ruby-oci8 2.0] OCI8::STMT_* are Symbols. (:select_stmt, :update_stmt, etc.)
438
- # [ruby-oci8 1.0] OCI8::STMT_* are Fixnums. (1, 2, 3, etc.)
439
+ # [ruby-oci8 1.0] OCI8::STMT_* are Integers. (1, 2, 3, etc.)
439
440
  #
440
441
  def type
441
442
  # http://docs.oracle.com/cd/E11882_01/appdev.112/e10646/ociaahan.htm#sthref5506