Rails tiny_tds symbol lookup error - ruby-on-rails

Get an error when running a query within a Rails app or console against a SQL Server with tiny_tds.
Note: gem install tiny_tds was successful.
Undefined symbol: rb_thread_blocking_region
../bin/ruby: symbol lookup error:
/var/www/.../tiny_tds-0.6.2/lib/tiny_tds/tiny_tds.so:
undefined symbol: rb_thread_blocking_region
My system setup:
Centos 7.0
Ruby 2.2.0p0
Rails 4.1.4
freetds and freetds-devel are installed:
Version: freetds v0.91
freetds.conf directory: /etc
MS db-lib source compatibility: yes
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: yes
My MSSQL section of config/database.yml looks like (I'm connecting to a remote host):
devel_sql:
adapter: sqlserver
mode: dblib
dataserver: DBSERVER\DBINSTANCE
encoding: utf8
database: SOMEDATABASENAME
username: xxxx
password: yyyy
reconnect: true
autocommit: true
timeout: 5000
My Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem 'pg'
# MSSQL gems
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter'
The query worked on a Centos 6.3. May any version conflicts?

I am using tiny_tds 0.6.2, ruby 2.2.2, capistrino 3.2.1 and unicorn 4.9.0.
tiny_tds 0.6.2 is not compatible with them. So i changed
gem 'tiny_tds', '~> 0.6.3.rc1'
and upgraded the tiny_tds and it worked. Hope it works for you and others too.

Found the solution. I verified that tiny_tds 0.6.2 runs with ruby 2.1.1.
ruby 2.2.0 seems not yet to be supported.
Found the discussion here.

Related

gcloud deploy error "Ruby version is 2.3.3, but your Gemfile specified 2.4.1", though my version is 2.4.1

I'm trying deploy a GAE project for the first time, after successfully publishing one of the test apps, and i'm getting an error regarding a wrong ruby version. I'm not sure if it's one of the other gems, but i'm not familiar with ROR or GCS, and i'm not sure what else to do.
Thanks.
Here are some of my system settings:
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin14]
$ rvm list
rvm rubies
* ruby-2.4.0 [ x86_64 ]
=> ruby-2.4.1 [ x86_64 ]
$ rails -v
Rails 5.0.2
Gem file:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.2'
ruby "2.4.1"
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 5.0.0.beta1'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
#gem 'coffee-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production do
gem "mysql2", "~> 0.3.0"
end
group :development, :test do
gem "sqlite3"
end
gem "rack"
gem "puma"
The default interpreter is currently Ruby 2.3.3. You can specify a different Ruby version by writing the version name to a .ruby-version file in your application directory. For example:
2.2.5
When a .ruby-version file is present, the runtime attempts to download and install the specified version of Ruby. If the version cannot be satisfied, you will receive an error message when deploying your application.
Docs: https://cloud.google.com/appengine/docs/flexible/ruby/runtime

Could not find gem 'rails (= 4.2.4) x64-mingw32'

I was first developing my RoR application in Windows. Now since I've been founding a few problems regarding some gems, SSH and stuff I decided to move to Linux. I am trying to initate the application, but It seems I am not able to.
When I do bundle update rails I got the following error:
Could not find gem 'rails (= 4.2.4) x64-mingw32' in the gems available on this
machine.
This is my tzinfo-data gem:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
But I have already tried with this one too:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Any idea? Because when I just do bundle install I also got the following error:
You have requested:
rails = 4.2.4
The bundle currently has rails locked at 4.2.4.
Try running `bundle update rails`
Update:
Gemfile content
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'devise'
gem 'bootstrap_form'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
gem "bcrypt-ruby", '~> 3.0.0'
gem 'google-api-client', '0.9'
gem 'letsrate'
gem 'will_paginate', '~> 3.0.6'
gem 'filterrific'
#gem 'ratyrate'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
If you’ve installed Rails using bundler and rubygems, make sure you have the latest version in your Gemfile:
rails '4.2.4'
there is Gemfile.lock which locks the version. You delete that and run again bundle install. it will work.
bundle install
Visit https://rubygems.org/gems
Search for your gem. Once found, copy the text from the box titled GEMFILE
Add the copied text in your Gemfile found inside your app
Run bundlefrom the console opened at the root of your app.
On successful installation of the gems your console will display the message:
Bundle complete! xx Gemfile dependencies, xx gems now installed.

Sqlite3 gem not loading, gem installed and specified in project

So in my quest to get a ruby dev environment working, I've ran into an issue that seems...confusing to this ruby noob.
When executing rails server, it starts up as expected, but when you put in localhost:3000 to your standard web browser, it replies the following:
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile.
Now here's the confusing part. I have sqlite3 installed (the 64 bit version, as that is what I downloaded, and am running a 64 bit OS), as verified by gem query (here's the full list of gems)
Uninstalling and reisntalling didn't do a lick of good for the issue at hand, but it did install without a hitch. Also the gemfile for the project that I'm testing this with is the folliwing
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
As you can see, sqlite3 is specified in the Gemfile quite early on, yet for whatever reason when I try to load the main page, it acts like it's not there.
Particulars for this machine are the following that weren't mentioned earlier in the gems section:
Rails 4
Ruby 2
Windows 7
Anyone ever ran into this before?
I just had this issue too. Go into your Gemfile.lock file and search for the 'sqlite3' entry. You'll note it reads sqlite3 (1.3.8-x86-mingw32).
Change that to sqlite3 (1.3.8-x64-mingw32) and then run the bundle install command and everything should work like normal.
I faced same issue and this seems to be Windows 7 specific Env issue. My problem was resolved with below changes
Go into your Gemfile.lock file and update sqlite3 (1.3.8-x86-mingw32) to sqlite3 (1.3.8-x64-mingw32)
Run bundle install from the project directory. That will update Gemfile.lock. You also have to restart the Rails server.
Also see config/database.yml which specifies which gem to use for the database.
development:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000

Could not load 'active_record/connection_adapters/sqlite3_adapter'

I'm trying to install ROR on my notebook (Debian Wheezy 64 bit).
On first I had this issue (enter link description here ) solved by the first answer.
Now the rails server starts, but surfing on the browser at localhost:3000 I get the following error:
Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.
I've installed ruby 2.0.0 compiling the source code, no errors or mistakes.
Then I've installed some needed libraries (sqlite3, libsqlite3-dev )...
Here is my GemFile:
'https://rubygems.org'
-# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
-# Use sqlite3 as the database for Active Record
gem 'sqlite3'
-# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
-# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
-# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
-# See https://github.com/sstephenson/execjs#readme for more supported runtimes
-# gem 'therubyracer', platforms: :ruby
-# Use jquery as the JavaScript library
gem 'jquery-rails'
-# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
-# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
-# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
-# Use ActiveModel has_secure_password
-# gem 'bcrypt-ruby', '~> 3.0.0'
-# Use unicorn as the app server
-# gem 'unicorn'
-# Use Capistrano for deployment
-# gem 'capistrano', group: :development
-# Use debugger
-# gem 'debugger', group: [:development, :test]
gem 'execjs'
gem 'therubyracer'
And in my database.yml:
-# SQLite version 3.x
-# gem install sqlite3
-#
-# Ensure the SQLite 3 gem is defined in your Gemfile
-# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
My gem version:
ruby 2.0.0
rails 4.0.0
sqlite 1.3.7
Came across this error playing around in Sinatra today when running rake db:create_migration. My error was erroneously specifying a "sqlite:" database type in app.rb when it should have been "sqlite 3 :". Example:
wrong:
set :database, 'sqlite:name.db'
correct:
set :database, 'sqlite3:name.db'
I've just struggled through this today. My error when trying to run rake db:create or rake db:migrate or running the server was slightly different:
/Users/lisa/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': Could not load 'active_record/connection_adapters/sqlite_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)
Note that it's trying to load sqlite_adapter, not sqlite3_adapter, despite the fact that my database.yml file is valid and does have 'sqlite3' in it. I did all kinds of things to my database.yml which caused me to realize that no matter what I tried (e.g. postgresql) rails was still trying to load sqlite. I finally looked around for something that was overriding database.yml and found it:
$ env | grep sqlite
DATABASE_URL=sqlite:////Users/lisa/dev/mango/devdb.sqlite
This was set for playing around with django and was screwing up my rails environment. Ouch.

Why won't my Gemfile run?

I am following the Hartl Ruby on Rails tutorial, and am in section 1.2.4 of the tutorial
When setting up a Rails app it says to run these commands:
cd first_app_direcory
sublime Gemfile
bundle update
The sublime Gemfile command edits the Gemfile obviously, but when I try to run the command bundle update I get the following error:
bundle update
Gemfile syntax error:
ruby 2.0.0
^
/home/cameron/ruby/ror/first_app/Gemfile:2:
syntax error, unexpected tINTEGER,
expecting '('
ruby 2.0.0
^
I took these two lines out of the gemfile, even though it says to include them. Also, I tried Ruby 1.9.3, and still got the same error message.
ruby 2.0.0
#ruby-gemset=railstutorial_rails_4_0
After taking these lines out, it worked. I am trying to get it to work with those lines in the gemfile though. How can I do this?
This is the full Gemfile:
source 'https://rubygems.org'
ruby 2.0.0
#ruby-gemset=railstutorial_rails_4_0
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
group :developent do
gem 'sqlite3', '1.3.7'
end
# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails', '2.2.1'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.3.20',require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
You should have
ruby '2.0.0'
instead of
ruby 2.0.0
in your Gemfile.
I think you need quotes around the 2.0.0.
Something like ruby "2.0.0".

Resources