Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
rake db:migrate error
5 Posts
rake db:migrate error

when I run this cmd I get error msg "development database not configured". My yml file is development: adapter: oracle_enhanced database: xe Username: Password: //host: "localhost:1521"

I have ruby 1.8.7 and have installed all req gems

Any suggestions gratefully received. Laurie

Are you on Rails 3? Check out this blog, it may help...

http://blog.rayapps.com/tags/oracle_enhanced/

Thanks I gave up with my previous setup and now have Ruby1.9.2 and Rails3.0.3 with gems installed ruby oci8 (2.0.4 x86-mingw32) and activerecord -oracle_enhanced-adapter (1.3.1) I have tried numerous configs in the yml file but to no avail. I try to connect to the xe database but everytime get the following error msg Could not find gem 'sqlite3-ruby<>=0, runtime) in any sources. I dont want to run sqlite3 so haven't this time downloaded it. I am completely mystified. Help please. Thanks. Laurie

Laurie, using ubuntu and oracle 10g xe I had no trouble getting it to work. Are you trying to do this on Windows?

I don’t know if you are familiar with linux but here is a list of the commands and outputs to those commands that I used to get a new rails app to create a table in the oracle database.

In the following commands, I am logged into a server named “vagrantup” as a linux user “oracle”.

oracle@vagrantup:$ whoami
oracle

oracle@vagrantup:$ hostname
vagrantup

Check if Oracle is running…

oracle@vagrantup:$ ps aux|grep XE|grep dbw
 oracle 610 0.0 2.5 228504 12880 ? Ss 11:24 0:00 xe_dbw0_XE

Check if the Oracle listener is running...

oracle@vagrantup:$ ps aux|grep lsnr 
oracle 594 0.0 0.8 21812 4216 ? Ss 11:24 0:00 /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/tnslsnrLISTENER -inherit

Check the user oracle has the right environment set... oracle@vagrantup:$ env|grep ORA
ORACLE_SID=XE
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server

oracle@vagrantup:$ sqlplus system@XE SQLPlus: Release 10.2.0.1.0 – Production on Mon Nov 22 15:09:43 2010 Copyright© 1982, 2005, Oracle. All rights reserved. Enter password: Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 – Production

oracle@vagrantup:$ rails -v
Rails 3.0.3
 oracle@vagrantup:$ rails new my_app -d oracle

oracle@vagrantup:$ cd my_app/

oracle@vagrantup:/my_app$ pwd
/usr/lib/oracle/xe/my_app

oracle@vagrantup:/my_app$ vim config/database.yml

development: adapter: oracle_enhanced database: XE username: system password: oracle

Note: I did the same config for test and production too. I know using system’s schema for user data is a no-no, but this is just a test environment that I will tear down. (I love vagrant for this.)

Note: modify the Gemfile as per the following…

oracle@vagrantup:/my_app$ vim Gemfile gem ‘ruby-oci8’, ‘> 2.0.4’
gem ‘activerecord-oracle_enhanced-adapter’, ‘> 1.3.1’
gem “ruby-plsql”, “> 0.4.3”

oracle@vagrantup:/my_app$ bundle install


Fetching source index for http://rubygems.org/%C3%A2%E2%82%AC%C2%A8Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.3) 
Using builder (2.1.2) 
Using i18n (0.4.2) 
Using activemodel (3.0.3) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.6) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.3) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.10) 
Using actionmailer (3.0.3) 
Using arel (2.0.4) 
Using activerecord (3.0.3) 
Installing activerecord-oracle_enhanced-adapter (1.3.1) 
Using activeresource (3.0.3) 
Using bundler (1.0.7) 
Using thor (0.14.6) 
Using railties (3.0.3) 
Using rails (3.0.3) 
Installing ruby-oci8 (2.0.4) with native extensions 
Installing ruby-plsql (0.4.4)

oracle@vagrantup:/my_app$ ls 
app config config.ru db doc Gemfile Gemfile.lock lib log public Rakefile README script test tmp vendor


oracle@vagrantup:/my_app$ ./script/rails generate scaffold Post title:string body:text

[The usual output]

oracle@vagrantup:/my_app$ rake db:migrate 
(in /usr/lib/oracle/xe/my_app)
CreatePosts: migrating ==================================================
— create_table(:posts) -> 0.0319s
CreatePosts: migrated (0.0320s) =========================================

oracle@vagrantup:$ sqlplus system@XE SQLPlus: Release 10.2.0.1.0 – Production on Mon Nov 22 15:30:31 2010 Copyright© 1982, 2005, Oracle. All rights reserved. Enter password: Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 – Production

SQL> desc posts; Name Null? Type ID NOT NULL NUMBER TITLE VARCHAR2 BODY CLOB CREATED_AT DATE UPDATED_AT DATE

I was a kind of very useful for me book reports and my friends!!!

5 Posts
Login to add your message