Ruby on Rails Friday, April 29, 2011

Hello Bryan Crosslan,

       In my system Ubuntu lucid 10.04 in this system unixodbc debian package installation not installed properly because of  incomplete setup files. Otherwise its will working fine.


On Fri, Apr 22, 2011 at 7:40 PM, Bryan Crossland <bacrossland@gmail.com> wrote:
On Thu, Apr 21, 2011 at 7:01 AM, DHAMODHARAN N <dhamsoft@gmail.com> wrote:
Hello Bryan Crosslan,
   As per the information what they are mentioned in this link http://lambie.org/2008/02/28/connecting-to-an-mssql-database-from-ruby-on-ubuntu/
configured. Initially i can  able to access through dbi but now its arise  same error.   
In irb
Trying with Sequel:

 
 irb(main):001:0>
 irb(main):001:0> require "rubygems"
 => true 
irb(main):002:0> require "sequel_core"
 => true irb(main):003:0> require "odbc" => true
 irb(main):004:0> db = Sequel.odbc("dbname", :uid=>"username",:pwd=>"password",:driver=>'{FreeTDS}') 
=> #<Sequel::ODBC::Database: "odbc:/dbname">
 irb(main):005:0> result=db["select * form tblCountry"]
 => #<Sequel::ODBC::Dataset: "select * form tblCountry"> 
irb(main):006:0> result.map {|r| puts r.inspect} 
Sequel::DatabaseConnectionError: ODBC::Error: INTERN (0) [RubyODBC]Cannot allocate SQLHENV
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/adapters/odbc.rb:35:in `initialize'
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/adapters/odbc.rb:35:in `new'
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/adapters/odbc.rb:35:in `connect'
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/database/misc.rb:45 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool.rb:92:in `call'
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool.rb:92:in `make_new' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:126:in `make_new' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:112:in `available' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:102:in `acquire' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:146:in `sync' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:146:in `synchronize' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:146:in `sync'
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:101:in `acquire' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/connection_pool/threaded.rb:74:in `hold' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/database/connecting.rb:226:in `synchronize'
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/adapters/odbc.rb:49:in `execute' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/dataset/actions.rb:541:in `execute' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/adapters/odbc.rb:91:in `fetch_rows' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/dataset/actions.rb:123:in `each' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/dataset/actions.rb:342:in `map' 
 from /usr/lib/ruby/gems/1.8/gems/sequel-3.21.0/lib/sequel/dataset/actions.rb:342:in `map' 
 from (irb):6 	from /usr/local/lib/site_ruby/1.8/rubygems/exceptions.rb:4irb(main):007:0> 


Trying with dbi:
irb(main):001:0> require "dbi" 
=> true 
irb(main):002:0> db=DBI.connect("dbi:ODBC:dbname",'username','password') 
DBI::DatabaseError: INTERN (0) [RubyODBC]Cannot allocate SQLHENV
 from /usr/lib/ruby/1.8/dbd/odbc/driver.rb:36:in `connect' 
 from /usr/lib/ruby/1.8/dbi/handles/driver.rb:33:in `connect' 
 from /usr/lib/ruby/1.8/dbi.rb:148:in `connect' 	from (irb):2 
 from /usr/lib/ruby/1.8/i486-linux/rbconfig.rb:170 
irb(main):003:0> 

On Wed, Apr 20, 2011 at 9:15 PM, Bryan Crossland <bacrossland@gmail.com> wrote:
On Wed, Apr 20, 2011 at 1:24 AM, DHAMODHARAN N <dhamsoft@gmail.com> wrote:
Hello friends,

  I tried to connect MSSql with Ruby on Ubuntu follow  this link its working nice. But i tried with Sequel.connect method connection was established but try to fetching data following error was  raised
 
irb(main):035:1> DB.synchronize do |conn| 
irb(main):035:1> end

Sequel::DatabaseConnectionError: ODBC::Error: IM002 (0) [unixODBC][Driver Manager]Data source name not found, and no default driver specified


Please give suggestions to resolve this error.


Thanks & Regards,

Dhamodharan N



Please post your code of how you are making the connection.

Thanks,
B. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment