[Ironruby-core] Ironruby on Rails with SQL Azure

Ameer Deen lists at ruby-forum.com
Tue Aug 31 21:29:03 EDT 2010


Hello Everyone,

I'm trying to connect a vanilla rails application running on IronRuby to
SQLAzure. The rails app is running on my laptop trying to connect to SQL
Azure. When I point  database.yml against my local instance, I'm able to
communicate with SQL Server:

development:
  mode: ADONET
  adapter: sqlserver
  host: .
  database: mydb
  username: myuser
  password: mypassword

But when I point to SQL Azure:

development:
  mode: ADONET
  adapter: sqlserver
  host: nrvk7uv6tl.database.windows.net
  database: mydb
  username: myuser
  password: mypassword


I get the error listed below. Has anyone had luck with Ironruby and SQL
Azure? I am able to connect to the SQL Azure instance using Enterprise
manger to verify the database is up and the user credentials are
correct. I can see from my netstat that myrails app is trying to connect
to the correct IP at port 1433 and has an established connection.

I'm not sure how to debug this further and would really appreciate
anyone pointing me in the right direction. Thanks for any help in
advance.

Ameer



  EXECUTE (387.0ms)   USE [cloudoman]
/!\ FAILSAFE /!\  Wed Sep 01 10:40:33 +1000 2010
  Status: 500 Internal Server Error
  You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter.rb:231:in
`database_year'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter.rb:203:in
`initialize'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.3.8/lib/active_record/connection_adapters/sqlserver_adapter.rb:28:in
`sqlserver_connection'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`__send__'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
    C:/ironruby-1.1/lib/ruby/1.8/monitor.rb:242:in `mon_synchronize'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in
`retrieve_connection'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in
`connection'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:9:in
`cache'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:28:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/session/cookie_store.rb:99:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in
`synchronize'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:114:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/reloader.rb:34:in
`run'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:108:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rails-2.3.8/lib/rails/rack/static.rb:31:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:45:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in
`each'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rails-2.3.8/lib/rails/rack/log_tailer.rb:17:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb:13:in
`call'
    C:/ironruby-1.1/lib/ironruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb:48:in
`service'
    C:/ironruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    C:/ironruby-1.1/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    C:/ironruby-1.1/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    IronRuby.Libraries:0:in `RubyThreadStart'
    IronRuby.Libraries:0:in `<CreateThread>b__0'
    mscorlib:0:in `ThreadStart_Context'
    mscorlib:0:in `Run'
    mscorlib:0:in `Run'
    mscorlib:0:in `ThreadStart'
  EXECUTE (394.0ms)   USE [cloudoman]
-- 
Posted via http://www.ruby-forum.com/.


More information about the Ironruby-core mailing list