Welcome Guest Login Register Member List
ExpressionEngine Forums
Advanced Search
Username: Password:
Remember Me? forgot password?
You are here: Forum Home  >  Usage  >  Troubleshooting  >  Thread
   
 
Tracks application: Migrate over to a non-mysql database:
 
wajahath
Posted: 04 May 2009 03:50 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  5
Joined  2009-04-22

I am a beginner with Ruby. I need to modify the database backend of an application (tracks) that currently uses Mysql as database(WORKS FINE WITH MYSQL). Need to change mysql backend database. Leant that Tracks application uses ActiveRecords and database.yml to talk to the database.

The database I am using is relatively unknown and uses a ODBC interface using a DSN name and so does not have a Ruby adapater for database.yml. I would have to use the ODBC approach thru database.yml right ?. But Tracks uses ACtiveREconds and I am using “ODBC” as the adapter name in the database.yml and the below corrosponding info.  I get the following error with the modified database.yml.

The database.yml is below
production:
adapter: ODBC
dsn: new_dsn
username: track
password: track


C:\gtd\tracks>ruby script/server -e production
=> Booting WEBrick…
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:252:in `activate’: undefined method `
map’ for nil:NilClass (NoMethodError)
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:274:in `activate’
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:273:in `each’
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:273:in `activate’
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `re
quire’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:153:in `require’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:521:in `new_constants_in’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:153:in `require’
      from C:/gtd/tracks/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:72:in `establish_connection’
      ... 18 levels…
      from C:/gtd/tracks/vendor/rails/railties/lib/commands/server.rb:49
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
m_original_require’
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
quire’
      from script/server:3

Additional info: For testing purposes, I wrote a small ruby program that uses DBI with ODBC data source name to connect to the database fine but need to make ot work thru database.yml and Activerecords for Tracks application.

Profile
 
Reinier Balt
Posted: 04 May 2009 08:58 PM   [ Ignore ]   [ # 1 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

what are you using for the odbc-rails driver?
http://odbc-rails.rubyforge.org/

Profile
 
wajahath
Posted: 04 May 2009 09:25 PM   [ Ignore ]   [ # 2 ]  
Newbie
Rank
Total Posts:  5
Joined  2009-04-22

Yes I am using the odbc-rail driver from http://odbc-rails.rubyforge.org/

Would really appreciate your help.

Profile
 
wajahath
Posted: 04 May 2009 11:07 PM   [ Ignore ]   [ # 3 ]  
Newbie
Rank
Total Posts:  5
Joined  2009-04-22

I am using the using the odbc-rail driver from http://odbc-rails.rubyforge.org/  and the error message I get is

C:\gtd\tracks>ruby script/server -e production
=> Booting WEBrick…
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:252:in `activate’: undefined method `
map’ for nil:NilClass (NoMethodError)
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `re
quire’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:153:in `require’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:521:in `new_constants_in’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:153:in `require’
      from C:/gtd/tracks/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:72:in `establish_connection’
      from C:/gtd/tracks/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:58:in `establish_connection’
      from C:/gtd/tracks/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:53:in `establish_connection’
      from ./script/../config/../vendor/rails/railties/lib/initializer.rb:392:
in `initialize_database’
      ... 15 levels…
      from C:/gtd/tracks/vendor/rails/railties/lib/commands/server.rb:49
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
m_original_require’
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
quire’
      from script/server:3

Profile
 
wajahath
Posted: 05 May 2009 04:03 PM   [ Ignore ]   [ # 4 ]  
Newbie
Rank
Total Posts:  5
Joined  2009-04-22

To try and recreate this problem just change the database.yml to use an odbc data source name for same mysql database. I tried using a dsn name to connect to mysql and used that info in database.yml and recreates the same error.

database.yml:
production:  adapter: odbc   dsn: mysql   host: localhost   username: track   password: track

Error message:
C:\gtd\tracks>ruby script/server -e production
=> Booting WEBrick…
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems.rb:252:in `activate’: undefined method `
map’ for nil:NilClass (NoMethodError)
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `re
quire’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:153:in `require’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:521:in `new_constants_in’
      from C:/gtd/tracks/vendor/rails/activesupport/lib/active_support/depende
ncies.rb:153:in `require’
      from C:/gtd/tracks/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:72:in `establish_connection’
      from C:/gtd/tracks/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:58:in `establish_connection’
      from C:/gtd/tracks/vendor/rails/activerecord/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:53:in `establish_connection’
      from ./script/../config/../vendor/rails/railties/lib/initializer.rb:392:
in `initialize_database’
      ... 15 levels…
      from C:/gtd/tracks/vendor/rails/railties/lib/commands/server.rb:49
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
m_original_require’
      from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
quire’ from script/server:3
*************
In other words, can we say that the odbc approach using ActiveRecords is broken ??? Bug in odbc-rails.rubyforge.org ?
To try and recreate this problem just change the database.yml to use an odbc data source name for same mysql database.

Any help would be really appreciated….

**********
(output of odbc adapter installation)
>ruby install_odbc.rb
<< Installation script for Rails ODBC Adapter >>
Checking if RubyGems is installed.
Looking for installed ActiveRecord gems.
Target ActiveRecord directory for install:
[C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record]
Enter c to change target ActiveRecord directory, q to quit, i to install
i Copying ODBC Adapter files into the ActiveRecord tree.
——————————————————————————————
./vendor/odbcext_virtuoso.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.
2/lib/active_record/./vendor/odbcext_virtuoso.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_virtuoso.rb
./vendor/odbcext_sybase_col.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.
3.2/lib/active_record/./vendor/odbcext_sybase_col.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_sybase_col.rb
./vendor/odbcext_sybase.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/
lib/active_record/./vendor/odbcext_sybase.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_sybase.rb
./vendor/odbcext_sqlanywhere_col.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activereco
rd-2.3.2/lib/active_record/./vendor/odbcext_sqlanywhere_col.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_sqlanywhere_col.rb
./vendor/odbcext_sqlanywhere.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2
.3.2/lib/active_record/./vendor/odbcext_sqlanywhere.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_sqlanywhere.rb
./vendor/odbcext_progress89.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.
3.2/lib/active_record/./vendor/odbcext_progress89.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_progress89.rb
./vendor/odbcext_progress.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.
2/lib/active_record/./vendor/odbcext_progress.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_progress.rb
./vendor/odbcext_postgresql.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.
3.2/lib/active_record/./vendor/odbcext_postgresql.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_postgresql.rb
./vendor/odbcext_oracle.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/
lib/active_record/./vendor/odbcext_oracle.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_oracle.rb
./vendor/odbcext_mysql.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/l
ib/active_record/./vendor/odbcext_mysql.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_mysql.rb
./vendor/odbcext_microsoftsqlserver_col.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/act
iverecord-2.3.2/lib/active_record/./vendor/odbcext_microsoftsqlserver_col.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_microsoftsqlserver_col.rb
./vendor/odbcext_microsoftsqlserver.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activer
ecord-2.3.2/lib/active_record/./vendor/odbcext_microsoftsqlserver.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
/vendor/odbcext_microsoftsqlserver.rb
./vendor/odbcext_ingres.rb -> C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/
lib/active_record/./vendor/odbcext_ingres.rb
chmod 0644 C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/.
Checking for Ruby ODBC BrC Bridge.
Done

Profile
 
Reinier Balt
Posted: 06 May 2009 06:39 PM   [ Ignore ]   [ # 5 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

I think your right that this is a problem with the odbc-rails driver

Did you get success using the mysql directly, i.e. with the default mysql-rails driver? If there is success there, the odbc driver for rails is not working I guess. Perhaps the mailing list / forum of odbc-rails could help?

Profile
 
Reinier Balt
Posted: 06 May 2009 06:43 PM   [ Ignore ]   [ # 6 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

an other explaination could be that you are installing the driver for your local rails 2.3.2. Tracks is currently using rails 2.2.2, so there could be some incompatibility there.

You could consider
* downgrading your local gem to 2.2.2 and reinstall the driver
* use the gem instead of install script
* install the driver in the rails tree of tracks, i.e. /path/to/tracks/vendor/rails/activerecord

Profile
 
wajahath
Posted: 06 May 2009 10:04 PM   [ Ignore ]   [ # 7 ]  
Newbie
Rank
Total Posts:  5
Joined  2009-04-22

Thanks for your response. I really appreciate it.

The error I am currently at is.

linux:/home/gds/tracks # ruby script/server -e production
=> Booting WEBrick…
/home/gds/tracks/app/models/tag.rb:7: warning: already initialized constant DELIMITER
/home/gds/tracks/app/models/tag.rb:8: warning: already initialized constant JOIN_DELIMITER
/usr/lib/ruby/gems/1.8/gems/activerecord-odbc-adapter-2.0/lib/active_record/connection_adapters/odbc_adapter.rb:1946:in `odbc_connection’: The Ruby ODBC module could not be loaded. (LoadError)
      from /home/gds/tracks/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send’
      from /home/gds/tracks/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection’
      from /home/gds/tracks/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection’
      from /home/gds/tracks/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout’


I did and find on odbc.so and there is no odbc.so and other files.  Please help.

Also, I just downloaded the rails-2.2.2 and installed it. But when tried to install the odbc-rails drive (1.5) under driver in the rails tree of tracks, i.e. /path/to/tracks/vendor/rails/activerecord it does not allow with a message that the target folder needs to have vendor and connection_adapters subfolder.

Profile
 
Reinier Balt
Posted: 07 May 2009 05:34 PM   [ Ignore ]   [ # 8 ]  
Sr. Member
RankRankRankRank
Total Posts:  580
Joined  2006-10-05

I’m out of options here.
The load error probably means that the odbc-rails driver cannot be found

* Did the install in your local rails2.2.2 go well?
* Did you remove the 2.3.2 gem?

Profile
 
   
 
 
‹‹ Plain text, XML, and 404 when attempting to modify tasks in Home Tab      Page with only add action form? ››

Powered By ExpressionEngine
Template Design By Sonnenvogel.com
Select a theme:

ExpressionEngine Discussion Forum - Version 2.1.2 (20091002)
Script Executed in 0.1637 seconds

Atom Feed
RSS 2.0