 |
Forums |
Admin Start New Thread
By: Helio Rodrigues
RE: Ruby OCI8 for windows [ reply ] 2011-02-28 20:58
|
Hi Lori,
I think I found the reason for the last error.
I found a difference in how ActiveRecord handles the columns when using Oracle & MySQL.
When I'm querying or creating records in MySQL I have to do like this:
provisioning.rb
myVar = MyClass.create(:MY_COLUMN => value)
myObjs = MyClass.find(:all)
view.html.rb
<% @myObjs.each do | myVar | %>
<td><%= myVar[MY_COLUMN] %>
<%end %>
But when using oracle I have to put everything in lower case and it's like this:
myVar = MyClass.create(:my_column => value)
myObjs = MyClass.find(:all)
view.html.rb
<% @myObjs.each do | myVar | %>
<td><%= myVar[my_column] %>
<%end %>
In both DBs the columns are all created with upper case but the Active Record requires that on oracle to be different from MySQL.
If I use MySQL Query Browser I have to use it in upper case, but when using Ora SQLPlus I can use either upper or lower case.
I expected to have this kind of differences handled by the Active Record.
Thanks.
/Helio
|
By: Helio Rodrigues
RE: Ruby OCI8 for windows [ reply ] 2011-02-28 18:19
|
Hi Lori.
I was able to install the version 1.0.7, configure tnsnames.ora and this part is working.
I'm using Active Record and trying to create a record in a table.
But I'm getting this error message:
undefined method `<MY_COLUMN_NAME>=' for #
This is an exception that I'm having on the begin rescue block when I try to add a record.
This code works with MySQL and might need some changes to work with Oracle.
Thanks a lot for your help, and my battle with Ruby continue!
/Helio
|
By: Helio Rodrigues
RE: Ruby OCI8 for windows [ reply ] 2011-02-28 17:59
|
Ok.
I tried to uninstall and install the new one and the installation of 1.0.7 failed too.
Can you help identifying the versions that I need to use? If you can please point out what documentation you are talking about?
Since I started working with Ruby I've never been able to understand what I really need or not.
It's been a very frustrating road...
Here are the details for the uninstall 2.0.4/install --version "< 2.0.0"
C:\>gem uninstall ruby-oci8
Select gem to uninstall:
1. ruby-oci8-2.0.2-x86-mswin32-60
2. ruby-oci8-2.0.4-x86-mingw32
3. All versions
> 3
Successfully uninstalled ruby-oci8-2.0.2-x86-mswin32-60
You have requested to uninstall the gem:
ruby-oci8-2.0.4-x86-mingw32
activerecord-oracle_enhanced-adapter-1.3.2 depends on [ruby-oci8 (~> 2.0.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] y
Successfully uninstalled ruby-oci8-2.0.4-x86-mingw32
C:\>gem list
*** LOCAL GEMS ***
actionmailer (2.3.3, 2.1.2)
actionpack (2.3.3, 2.1.2)
activerecord (2.3.3, 2.1.2)
activerecord-oracle-adapter (1.0.0.9250)
activerecord-oracle_enhanced-adapter (1.3.2, 1.3.1, 1.2.1)
activeresource (2.3.3, 2.1.2)
activesupport (2.3.3, 2.1.2)
builder (3.0.0, 2.1.2)
cgi_multipart_eof_fix (2.5.0)
ci_reporter (1.6.4, 1.6.0)
columnize (0.3.2, 0.3.0)
commonwatir (1.7.1, 1.6.2)
dbi (0.4.5, 0.4.2)
deprecated (3.0.0, 2.0.1)
fastthread (1.0.1 i386-mswin32)
firewatir (1.6.2)
fxri (0.3.6)
fxruby (1.6.19 x86-mswin32-60, 1.6.6 mswin32)
gem_plugin (0.2.3)
highline (1.5.1)
hoe (1.12.2)
hpricot (0.4 mswin32)
json_pure (1.4.6)
linecache (0.43 mswin32)
log4r (1.0.5)
mongrel (1.1.5 x86-mswin32-60)
mongrel_cluster (1.0.5)
mysql (2.8.1 x86-mswin32, 2.7.3 mswin32)
net-sftp (2.0.2)
net-ssh (2.0.11)
paginator (1.1.1)
pg (0.9.0 x86-mswin32, 0.8.0 x86-mswin32-60)
rack (1.0.0)
rails (2.3.3, 2.1.2)
rake (0.8.7, 0.7.2)
rcov (0.8.1.2.0 mswin32)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3 mswin32)
ruby-debug-ide (0.4.5)
ruby-postgres (0.7.1.2006.04.06 mswin32)
rubyforge (2.0.4, 1.0.4, 1.0.3)
rubygems-update (1.3.7, 1.3.5, 1.3.3)
s4t-utils (1.0.4)
sources (0.0.1)
sqlite3-ruby (1.2.1 mswin32)
tzinfo (0.3.13)
user-choices (1.1.6)
watir (1.6.2)
win32-api (1.4.0 x86-mswin32-60)
win32-clipboard (0.4.1)
win32-dir (0.3.1)
win32-eventlog (0.4.3)
win32-file (0.5.3)
win32-file-stat (1.2.3)
win32-process (0.6.0, 0.5.1)
win32-sapi (0.1.3 mswin32)
win32-sound (0.4.0)
windows-api (0.3.0)
windows-pr (1.0.5, 0.6.2)
xml-simple (1.0.12)
C:\>gem install ruby-oci8 --version "< 2.0.0"
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - C:/ruby/lib/ruby/gems/1.8/gems/ruby-oci8-2.0.4-x86-mingw
32/lib/oci8lib_18.so
C:\>
|
By: Lori Olson
RE: Ruby OCI8 for windows [ reply ] 2011-02-28 17:53
|
|
Yes. It has to do with the version of Rails 2.x that you are using. If you aren't going to upgrade all the way to the current versions of everything, then use the versions that are documented to work together.
|
By: Helio Rodrigues
RE: Ruby OCI8 for windows [ reply ] 2011-02-28 17:39
|
Why do I need to downgrade to 1.0.7?
Because the actual version is bad?
Following other link references I was able to install the version 2.0.4.
ruby-oci8 (2.0.4 x86-mingw32, 2.0.2 x86-mswin32-60)
Would you still suggest me to downgrade to 1.0.7?
Thanks,
/Helio
|
By: Lori Olson
RE: Ruby OCI8 for windows [ reply ] 2011-02-28 17:28
|
You need to back up, and make *certain* that you have a version of ruby-oci8 installed that is *not* version 2.0.x. I see from your gem list, that you have 2.0.2 installed. You might need to uninstall that one completely, and then install version 1.0.7. After that, you should be ok.
See this particular comment from the forum posting you referenced:
http://www.ruby-forum.com/topic/182145#819779
|
By: Helio Rodrigues
Ruby OCI8 for windows [ reply ] 2011-02-28 17:20
|
I'm trying to install ruby oci 8 to test my app with oracle but it's kind of hard.
I'm trying to update the original oci I have because it's not working.
The error I get in my app is:
"undefined method `define_a_column' for class `OCI8::Cursor'"
I google it and I was following the instructions on this link "http://www.ruby-forum.com/topic/182145"
Follow the errors I have:
C:\gem update ruby-oci8
Updating installed gems
Updating ruby-oci8
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing ruby-oci8:
ERROR: Failed to build gem native extension.
C:/ruby/bin/ruby.exe extconf.rb
checking for load library path...
PATH...
checking C:\RubyDevKit\bin... no
checking C:\RubyDevKit\mingw\bin... no
checking C:\Program Files\Microsoft Visual Studio 8\Common7\IDE... no
checking C:\Program Files\Microsoft Visual Studio 8\VC\BIN... no
checking C:\Program Files\Microsoft Visual Studio 8\Common7\Tools... no
checking C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin... no
checking C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727... no
checking C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages... no
checking C:\Program Files\RSA SecurID Token Common... no
checking %CommonProgramFiles%\Microsoft Shared\Windows Live... no
checking C:\WINDOWS\system32... yes
C:/WINDOWS/system32/oci.dll looks like an instant client.
checking for cc... ng
---------------------------------------------------
Error Message:
C compiler doesn't work correctly.
Backtrace:
./oraconf.rb:562:in `check_cc'
./oraconf.rb:549:in `init'
./oraconf.rb:1001:in `initialize'
./oraconf.rb:343:in `new'
./oraconf.rb:343:in `get'
extconf.rb:18
---------------------------------------------------
See:
* http://ruby-oci8.rubyforge.org/en/HowToInstall.html
* http://ruby-oci8.rubyforge.org/en/ReportInstallProblem.html
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--srcdir=.
--curdir
--ruby=C:/ruby/bin/ruby
--with-instant-client
--without-instant-client
./oraconf.rb:562:in `check_cc': RuntimeError (RuntimeError)
from ./oraconf.rb:549:in `init'
from ./oraconf.rb:1001:in `initialize'
from ./oraconf.rb:343:in `new'
from ./oraconf.rb:343:in `get'
from extconf.rb:18
Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/ruby-oci8-2.0.
4 for inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/ruby-oci8-2.0.4/ext/oci8/gem_ma
ke.out
Nothing to update
C:\>
This is the gem list I have:
C:\>gem list
*** LOCAL GEMS ***
actionmailer (2.3.3, 2.1.2)
actionpack (2.3.3, 2.1.2)
activerecord (2.3.3, 2.1.2)
activerecord-oracle-adapter (1.0.0.9250)
activerecord-oracle_enhanced-adapter (1.3.2, 1.3.1, 1.2.1)
activeresource (2.3.3, 2.1.2)
activesupport (2.3.3, 2.1.2)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
ci_reporter (1.6.0)
columnize (0.3.0)
commonwatir (1.6.2)
dbi (0.4.2)
deprecated (2.0.1)
fastthread (1.0.1 i386-mswin32)
firewatir (1.6.2)
fxri (0.3.6)
fxruby (1.6.19 x86-mswin32-60, 1.6.6 mswin32)
gem_plugin (0.2.3)
highline (1.5.1)
hoe (1.12.2)
hpricot (0.4 mswin32)
json_pure (1.4.6)
linecache (0.43 mswin32)
log4r (1.0.5)
mongrel (1.1.5 x86-mswin32-60)
mongrel_cluster (1.0.5)
mysql (2.8.1 x86-mswin32, 2.7.3 mswin32)
net-sftp (2.0.2)
net-ssh (2.0.11)
paginator (1.1.1)
pg (0.9.0 x86-mswin32, 0.8.0 x86-mswin32-60)
rack (1.0.0)
rails (2.3.3, 2.1.2)
rake (0.8.7, 0.7.2)
rcov (0.8.1.2.0 mswin32)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3 mswin32)
ruby-debug-ide (0.4.5)
ruby-oci8 (2.0.2 x86-mswin32-60)
ruby-postgres (0.7.1.2006.04.06 mswin32)
rubyforge (2.0.4, 1.0.4, 1.0.3)
rubygems-update (1.3.7, 1.3.5, 1.3.3)
s4t-utils (1.0.4)
sources (0.0.1)
sqlite3-ruby (1.2.1 mswin32)
tzinfo (0.3.13)
user-choices (1.1.6)
watir (1.6.2)
win32-api (1.4.0 x86-mswin32-60)
win32-clipboard (0.4.1)
win32-dir (0.3.1)
win32-eventlog (0.4.3)
win32-file (0.5.3)
win32-file-stat (1.2.3)
win32-process (0.6.0, 0.5.1)
win32-sapi (0.1.3 mswin32)
win32-sound (0.4.0)
windows-api (0.3.0)
windows-pr (1.0.5, 0.6.2)
xml-simple (1.0.12)
This is a very urgent problem.
Is there anybody here that can help me?
Thanks.
/Helio
|
|
 |