 |
Forums |
Admin Discussion Forums: help Start New Thread
By: Praveen Devarao
RE: New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-06 18:26
|
Hi David,
Thanks for updating.
Regarding how to know if is 32-bit or 64-bit, Although I have not used myself I know dumpbin will help, but we will need to have Visual Studio (VS) installed.
Let me know, if you become aware of a better method to find if it is 64-bit or 32-bit executable (ruling out the VS dependency)
Thanks
Praveen
|
By: David Adler
RE: New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-06 11:03
|
Hi Praveen, my apologies. I had copied over the wrong ibm_db_adapter from the 3 downloads that are listed. It seems to be working now.
How do I know if I am running Ruby as 64-bit or 32-bit? I installed rubyinstaller-1.9.2-p290.exe.
Now the challenge is to move my application from Rails 2.3.5 to Rails 3.1.
Thank you for your help in getting this working.
|
By: Praveen Devarao
RE: New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-06 02:23
|
Hi David,
This is interesting. The Rake issue is a known one. What you could do is to just uninstall the available rake and try re-installing it. This worked for me.
The segmentation fault you are seeing is interesting. Did you use the new adapter (The latest one from the link I provided earlier [that reads "Changes as per Rails31 final release"])? If not then this is expected.
Are you running ruby as 64-bit exe or 32-bit exe?
Thanks
Praveen
|
By: David Adler
RE: New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-05 22:04
|
Hi Praveen, thank you for the quick response.
Does Rails ever work "out of the box"? I tried moving to 3.0 a year ago and gave up as it wasn't worth the effort to get it working.
You were correct, I did not successfully run the 'rake db:migrate'. This had failed with:
"uninitialized constant Rake::DSL"
One of the fixes I found was to put
require 'rake/dsl_definition'
in 'rakefile'
This fixed the problem when using sqllite.
There was another suggested fix to add
gem 'rake','0.8.7' to 'gemfile
but this caused other problems.
When I run 'rake db:migrate' it now seems to crash
the environment. The log contains:
Migrating to CreatePosts (20110904133046)
[1m[35m (423.0ms)[0m CREATE TABLE posts (id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1) PRIMARY KEY, name varchar(255), title varchar(255), ocntent clob, created_at timestamp, updated_at timestamp)
The console error is:
d:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
d:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:2217: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
-- control frame ----------
c:0046 p:---- s:0195 b:0195 l:000194 d:000194 CFUNC :prepare
c:0045 p:0185 s:0190 b:0190 l:000189 d:000189 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:2217
c:0044 p:0017 s:0182 b:0182 l:000161 d:000181 BLOCK d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:1000
c:0043 p:0005 s:0180 b:0180 l:000170 d:000179 BLOCK d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:244
c:0042 p:0032 s:0178 b:0178 l:000177 d:000177 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/notifications/instrumenter.rb:21
c:0041 p:0046 s:0171 b:0171 l:000170 d:000170 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:239
c:0040 p:0025 s:0162 b:0162 l:000161 d:000161 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:999
c:0039 p:0064 s:0157 b:0157 l:000156 d:000156 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:1037
c:0038 p:0017 s:0149 b:0149 l:000148 d:000148 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:63
c:0037 p:0053 s:0143 b:0143 l:000142 d:000142 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:957
c:0036 p:0218 s:0133 b:0133 l:000132 d:000132 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:727
c:0035 p:0033 s:0127 b:0127 l:00173c d:000126 BLOCK d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:688
c:0034 p:---- s:0125 b:0125 l:000124 d:000124 FINISH
c:0033 p:---- s:0123 b:0123 l:000122 d:000122 CFUNC :call
c:0032 p:0011 s:0120 b:0120 l:002570 d:000119 BLOCK d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:742
c:0031 p:0232 s:0118 b:0118 l:000117 d:000117 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:19
c:0030 p:0025 s:0109 b:0109 l:000108 d:000108 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/transactions.rb:208
c:0029 p:0040 s:0104 b:0104 l:002570 d:002570 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:742
c:0028 p:0181 s:0100 b:0100 l:00173c d:00015c BLOCK d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:686
c:0027 p:---- s:0094 b:0094 l:000093 d:000093 FINISH
c:0026 p:---- s:0092 b:0092 l:000091 d:000091 CFUNC :each
c:0025 p:0223 s:0089 b:0089 l:00173c d:00173c METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:671
c:0024 p:0026 s:0080 b:0080 l:000079 d:000079 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:549
c:0023 p:0083 s:0075 b:0075 l:000074 d:000074 METHOD d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:530
c:0022 p:0115 s:0070 b:0070 l:001db8 d:000069 BLOCK d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:161
c:0021 p:---- s:0068 b:0068 l:000067 d:000067 FINISH
c:0020 p:---- s:0066 b:0066 l:000065 d:000065 CFUNC :call
c:0019 p:0043 s:0061 b:0061 l:000052 d:000060 BLOCK d:/Ruby192/lib/ruby/1.9.1/rake.rb:634
c:0018 p:---- s:0058 b:0058 l:000057 d:000057 FINISH
c:0017 p:---- s:0056 b:0056 l:000055 d:000055 CFUNC :each
c:0016 p:0171 s:0053 b:0053 l:000052 d:000052 METHOD d:/Ruby192/lib/ruby/1.9.1/rake.rb:629
c:0015 p:0110 s:0049 b:0049 l:000043 d:000048 BLOCK d:/Ruby192/lib/ruby/1.9.1/rake.rb:595
c:0014 p:0019 s:0047 b:0047 l:000046 d:000046 METHOD d:/Ruby192/lib/ruby/1.9.1/monitor.rb:201
c:0013 p:0033 s:0044 b:0044 l:000043 d:000043 METHOD d:/Ruby192/lib/ruby/1.9.1/rake.rb:588
c:0012 p:0048 s:0038 b:0038 l:000037 d:000037 METHOD d:/Ruby192/lib/ruby/1.9.1/rake.rb:581
c:0011 p:0045 s:0033 b:0033 l:000032 d:000032 METHOD d:/Ruby192/lib/ruby/1.9.1/rake.rb:2041
c:0010 p:0012 s:0026 b:0026 l:000011 d:000025 BLOCK d:/Ruby192/lib/ruby/1.9.1/rake.rb:2019
c:0009 p:---- s:0023 b:0023 l:000022 d:000022 FINISH
c:0008 p:---- s:0021 b:0021 l:000020 d:000020 CFUNC :each
c:0007 p:0069 s:0018 b:0018 l:000011 d:000017 BLOCK d:/Ruby192/lib/ruby/1.9.1/rake.rb:2019
c:0006 p:0009 s:0016 b:0016 l:000015 d:000015 METHOD d:/Ruby192/lib/ruby/1.9.1/rake.rb:2058
c:0005 p:0011 s:0012 b:0012 l:000011 d:000011 METHOD d:/Ruby192/lib/ruby/1.9.1/rake.rb:2013
c:0004 p:0031 s:0009 b:0009 l:000008 d:000008 METHOD d:/Ruby192/lib/ruby/1.9.1/rake.rb:1992
c:0003 p:0036 s:0006 b:0006 l:001edc d:001cc4 EVAL d:/Ruby192/bin/rake:31
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001edc d:001edc TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
d:/Ruby192/bin/rake:31:in `<main>'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:581:in `invoke'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
d:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `execute'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `each'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
d:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `call'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:161:in `block (2 levels) in <top (required)>'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:530:in `migrate'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:549:in `up'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:671:in `migrate'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:671:in `each'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:686:in `block in migrate'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:742:in `ddl_transaction'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/transactions.rb:208:in `transaction'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:742:in `block in ddl_transaction'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:742:in `call'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:688:in `block (2 levels) in migrate'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/migration.rb:727:in `record_version_state_after_migrating'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:957:in `insert'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:63:in `exec_insert'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:1037:in `exec_query'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:999:in `prepare'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:244:in `block in log'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:1000:in `block in prepare'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:2217:in `prepare'
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/connection_adapters/ibm_db_adapter.rb:2217:in `prepare'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
|
By: Praveen Devarao
RE: New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-05 04:54
|
Hi David,
I am able to repro this scenario, only in cases where I have not run migrations.
Did you run migrations (rake db:migrate)? Looks like not. the error is popped up due to not able to find the table in the database. Migrate your database and give a try.
Coming to the error message not being seen, looks like the error message is not being retrieved properly in the driver. I will look into this and have it fixed.
Thanks
Praveen
|
By: David Adler
RE: New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-04 17:58
|
Hi Praveen, thank you for the quick response.
'rails new myapp -d ibm_db'
is definitely the way to go as it nicely fills in the database.yml file.
I copied over the ibm_db_adapter.rb from the ones associated with http://rubyforge.org/tracker/index.php?func=detail&aid=29275&group_id=2361&ati
d=9175 and made the patch but I'm not getting much further.
This is my arel\visitors\ibm_db.rb
module Arel
module Visitors
class IBM_DB < Arel::Visitors::ToSql
private
def visit_Arel_Nodes_Limit o
@connection.set_limit visit o.expr
""
#"FETCH FIRST #{visit o.expr} ROWS ONLY"
end
def visit_Arel_Nodes_Offset o
@connection.set_offset visit o.expr
""
#"OFFSET #{visit o.expr}"
end
end
end
end
These are the messages that I get for
@posts = Post.all
E:\dwacode\rails31\test4>rails server
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-09-04 13:50:15] INFO WEBrick 1.3.1
[2011-09-04 13:50:15] INFO ruby 1.9.2 (2011-07-09) [i386-mingw32]
[2011-09-04 13:50:15] INFO WEBrick::HTTPServer#start: pid=2824 port=3000
d:/Ruby192/lib/ruby/gems/1.9.1/gems/ibm_db-2.5.6-x86-mingw32/lib/active_record/c
onnection_adapters/ibm_db_adapter.rb:2217: warning: Statement Prepare Failed: Γå
Ç┌╣Θ╖╕╥¼♠
Started GET "/posts" for 127.0.0.1 at 2011-09-04 13:50:33 -0400
DEPRECATION WARNING: Arel::Visitors::VISITORS is deprecated and will be removed.
Database adapters should define a visitor_for method which returns the appropri
ate visitor for the database. For example, MysqlAdapter.visitor_for(pool) return
s Arel::Visitors::MySQL.new(pool). (called from mon_synchronize at d:/Ruby192/li
b/ruby/1.9.1/monitor.rb:201)
Processing by PostsController#index as HTML
←[1m←[36mPost Load (2.0ms)←[0m ←[1mSELECT posts.* FROM posts ←[0m
RuntimeError: Failed to prepare sql SELECT posts.* FROM posts : SELECT posts.* F
ROM posts
Completed 500 Internal Server Error in 144ms
ActiveRecord::StatementInvalid (RuntimeError: Failed to prepare sql SELECT posts
.* FROM posts : SELECT posts.* FROM posts ):
app/controllers/posts_controller.rb:5:in `index'
|
By: Praveen Devarao
RE: New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-03 14:41
|
Hi David,
This error happens because the ibm_db gem is not specified in the Gemfile under
your app directory. Add the below line to your Gemfile and run bundle update
gem 'ibm_db'
This is a feature of the bundler gem (dependency of rails) that takes care of
your application dependencies via the gem file. For more details on bundler
visit http://gembundler.com/
You could also generate your app with the command below
rails new myapp -d ibm_db
with this specification of ibm_db, rails will automatically take care of all
configurations (including adding into the Gemfile).
One more thing to mention is, you will need to use the adapter attached
@ http://rubyforge.org/tracker/index.php?func=detail&aid=29275&group_id=2361&ati
d=9175 for functioning with Rails31. This will make into the next release, planned
to happen soon.
Let us know how it goes.
Thanks
Praveen
|
By: David Adler
New Windows 7 Ruby 1.9.2 Rails 3.1 ibm_db [ reply ] 2011-09-03 11:55
|
Is there current "getting started" documentation?
Ruby, Rails and ibm_db all appeared to install correctly.
Attempting to create a Rails migration I get the message:
d:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the ibm_db adapter: `gem install activerecord-ibm_db-adapter` (no such file to load -- active_record/connection_adapters/ibm_db_adapter) (RuntimeError)
Are there still some configuration files that need to be manually updated in order for ibm_db to work?
My old system is still running Rails 2.3.5 but I would like to try upgrading.
|
|
 |