Arun Gupta | 29 May 01:51

db:create gives "Unknown database"

I'm trying to install Typo 5.0.3 and "rake db:create" gives the following error:

-- cut here --
(in /Users/arungupta/samples/jruby/typo-5.0.3)
rake aborted!
#42000Unknown database 'typo_dev'

(See full trace by running task with --trace)
-- cut here --

I'm able to create other trivial Rails applications and db:create
database there.

-Arun

--

-- 
Web Technologies and Standards
Sun Microsystems, Inc.
Blog: http://blogs.sun.com/arungupta
Cyril Mougel | 29 May 08:30

Re: db:create gives "Unknown database"

On Thu, May 29, 2008 at 1:52 AM, Arun Gupta <arun.gupta <at> gmail.com> wrote:
> I'm trying to install Typo 5.0.3 and "rake db:create" gives the following error:
>
> -- cut here --
> (in /Users/arungupta/samples/jruby/typo-5.0.3)
> rake aborted!
> #42000Unknown database 'typo_dev'
>
> (See full trace by running task with --trace)
> -- cut here --
>
> I'm able to create other trivial Rails applications and db:create
> database there.
>

it's because the default environnement is development.

Try :

rake db:create RAILS_ENV='production'

So the creation are in typo production database. You know how is this
base in config.database.yml

--

-- 
Cyril Mougel
http://blog.shingara.fr
Arun Gupta | 29 May 16:24

Re: db:create gives "Unknown database"

Is it mandatory to use production database ?

The command below should generate the development database, isn't it ?

-Arun

On Wed, May 28, 2008 at 11:30 PM, Cyril Mougel <cyril.mougel <at> gmail.com> wrote:
> On Thu, May 29, 2008 at 1:52 AM, Arun Gupta <arun.gupta <at> gmail.com> wrote:
>> I'm trying to install Typo 5.0.3 and "rake db:create" gives the following error:
>>
>> -- cut here --
>> (in /Users/arungupta/samples/jruby/typo-5.0.3)
>> rake aborted!
>> #42000Unknown database 'typo_dev'
>>
>> (See full trace by running task with --trace)
>> -- cut here --
>>
>> I'm able to create other trivial Rails applications and db:create
>> database there.
>>
>
>
> it's because the default environnement is development.
>
> Try :
>
> rake db:create RAILS_ENV='production'
>
> So the creation are in typo production database. You know how is this
(Continue reading)

Cyril Mougel | 29 May 17:01

Re: db:create gives "Unknown database"

On Thu, May 29, 2008 at 4:24 PM, Arun Gupta <arun.gupta <at> gmail.com> wrote:
> Is it mandatory to use production database ?

No it's for your production mode. Because with the production
database, there are too production configuration about cache by
example. So it's advise to use production environnement for a blog not
use for developpement.

>
> The command below should generate the development database, isn't it ?

This commande create the database. But your user are right for create it ?

--

-- 
Cyril Mougel
http://blog.shingara.fr
Arun Gupta | 29 May 18:09

Re: db:create gives "Unknown database"

>> Is it mandatory to use production database ?
>
> No it's for your production mode. Because with the production
> database, there are too production configuration about cache by
> example. So it's advise to use production environnement for a blog not
> use for developpement.
Ok, I was trying it on my local so thought of trying the development
mode to begin with.

Even with production mode, I'm getting:

-- cut here --
(in /Users/arungupta/samples/jruby/typo-5.0.3)
rake aborted!
#42000Unknown database 'typo'

(See full trace by running task with --trace)
-- cut here --

>
>>
>> The command below should generate the development database, isn't it ?
>
> This commande create the database. But your user are right for create it ?
I'm using the database.yml bundled with Typo 5.0.3 and MySQL is also
default (username: root, password: <blank>).

-Arun

>
(Continue reading)

Scott Likens | 29 May 20:38

Re: db:create gives "Unknown database"

Okay this is plain silly,

what does your config/database.yml show?

Which Adapter are you using SQLite3? MySQL?

If you are using MySQL please create the database, db:create does not  
create the database for you.

... and if you are unaware of how to do that, then please read the  
manual for whatever adapter you are using.

On May 29, 2008, at 9:09 AM, Arun Gupta wrote:

>>> Is it mandatory to use production database ?
>>
>> No it's for your production mode. Because with the production
>> database, there are too production configuration about cache by
>> example. So it's advise to use production environnement for a blog  
>> not
>> use for developpement.
> Ok, I was trying it on my local so thought of trying the development
> mode to begin with.
>
> Even with production mode, I'm getting:
>
> -- cut here --
> (in /Users/arungupta/samples/jruby/typo-5.0.3)
> rake aborted!
> #42000Unknown database 'typo'
(Continue reading)

Arun Gupta | 30 May 02:49

Re: db:create gives "Unknown database"

> Okay this is plain silly,
Sorry, but not working for me :(

>
> what does your config/database.yml show?

It is the one bundled with Typoe 5.0.3 and shown here:

login: &login
  adapter: mysql
  host: localhost
  username: root
  password:

development:
  database: typo_dev
  <<: *login

test:
  database: typo_tests
  <<: *login

production:
  database: typo
  <<: *login

>
> Which Adapter are you using SQLite3? MySQL?
MySQL with JRuby

(Continue reading)

Scott Likens | 30 May 05:16

Re: db:create gives "Unknown database"

Arun,

First you need to modify the database.yml so it has permission to  
access typo_dev typo_tests or typo.

If  you want to run with root that's fine.

at a shell prompt type,

mysqladmin create typo
mysqladmin create typo_dev
mysqladmin create typo_tests

then you can try rake db:create

On May 29, 2008, at 5:49 PM, Arun Gupta wrote:

>> Okay this is plain silly,
> Sorry, but not working for me :(
>
>>
>> what does your config/database.yml show?
>
> It is the one bundled with Typoe 5.0.3 and shown here:
>
> login: &login
>  adapter: mysql
>  host: localhost
>  username: root
>  password:
(Continue reading)

Arun Gupta | 30 May 05:41

Re: db:create gives "Unknown database"

> First you need to modify the database.yml so it has permission to access
> typo_dev typo_tests or typo.
>
> If  you want to run with root that's fine.
Yep, that's fine with me since first I want to get the feel of Typo.

>
> at a shell prompt type,
>
> mysqladmin create typo
> mysqladmin create typo_dev
> mysqladmin create typo_tests
>
> then you can try rake db:create
I know mysqladmin command.

AIU the main point of db:create is to create the database. Since Rails
2.0, I've never use mysqladmin command to create the database and
always used db:create. I'm still confused why I need to explicitly
create the database using mysqladmin.

-Arun

>
> On May 29, 2008, at 5:49 PM, Arun Gupta wrote:
>
>>> Okay this is plain silly,
>>
>> Sorry, but not working for me :(
>>
(Continue reading)

Michael Hasenstein | 19 Jun 15:57

Re: db:create gives "Unknown database"

Arun Gupta wrote:

> AIU the main point of db:create is to create the database. Since Rails
> 2.0, I've never use mysqladmin command to create the database and
> always used db:create. I'm still confused why I need to explicitly
> create the database using mysqladmin.
> -Arun

Hi Arun,

No one here believes you? Well I do... had the same error. I found 
several URLs of the same sort, like 
http://justbarebones.blogspot.com/2008/05/rails-202-restful-authentication-and.html 
and this very recent bug report: 
http://rails.lighthouseapp.com/projects/8994/tickets/63-bug-rake-db-create-and-observers
However, I ended up giving up on rails and created my database manually. 
It IS a bug in rails, maybe triggered by one of the plugins, who knows. 
Since it only shows up at db creation time I thought it not worth 
investigating further.

To all those doubters here, first, db:create IS supposed to create the 
database. When I run it and the (empty!) schema exists it complains 
about this fact. When the schema doesn't exist I get the same error as 
Arun. It's just another bug in rails.

Michael
--

-- 
Posted via http://www.ruby-forum.com/.
Arun Gupta | 19 Jun 20:07

Re: db:create gives "Unknown database"

Thanks Michael,

Your statement is bringing sanity back to me :)

Since Rails 2.0 (now 2.1), I've always created database using
db:create. I was wondering why it just does not work with Typo but the
bug report seems to make some sense. Now the weird thing is that
config/environment.rb has:

config.active_record.observers = :email_notifier, :web_notifier

so the bug reports are not valid in this particular case. It seems
there is something more to it. Guess I'll blog about it.

-Arun

On Thu, Jun 19, 2008 at 6:57 AM, Michael Hasenstein
<ruby-forum-incoming <at> andreas-s.net> wrote:
> Arun Gupta wrote:
>
>> AIU the main point of db:create is to create the database. Since Rails
>> 2.0, I've never use mysqladmin command to create the database and
>> always used db:create. I'm still confused why I need to explicitly
>> create the database using mysqladmin.
>> -Arun
>
>
> Hi Arun,
>
> No one here believes you? Well I do... had the same error. I found
(Continue reading)

Scott Likens | 20 Jun 01:39

Re: db:create gives "Unknown database"

Hi,

It wasn't that I had any doubt that db:create should work, it was that  
rake task is defined in rails, and not typo.  So I felt it was more  
rails related.  Where it's casued or ended, I don't know.

it works for me with regular ruby 1.8.6, I don't use jruby so I did  
not test, but I assume that jruby is unrelated.

Unfortunately, I am a believer in testing w/ ruby only, as I have  
found some unique problems using rubinus, YARV and jruby that do not  
happen elsewhere...

When in doubt, try it the "normal" way, and if it works, backtrack and  
find out where and why it's failing.

... however for me personally I try to run a secure MySQL Server; so I  
give each rails app it's own login credentials, and db:create will/ 
would fail because I do not give it permission to create a database.   
Which is why I find db:create rake task to be downright silly.

Thanks for listening, no reply necessary.

On Jun 19, 2008, at 6:57 AM, Michael Hasenstein wrote:

> Arun Gupta wrote:
>
>> AIU the main point of db:create is to create the database. Since  
>> Rails
>> 2.0, I've never use mysqladmin command to create the database and
(Continue reading)

Pepe Junty | 25 Jun 00:00

Re: db:create gives "Unknown database"

i'm having the same problem since yesterday, whin i updated
to 2.1.0. for me the problem is that this new version of
rake is loading the files in my 'config/initializers' directory,
and one of the files has database operations, so as the database
is not created yet the 'db:create' task halts. i commented
the db calls and the db was created normally.
anyone knows how to avoid this loading? or why rake
is now loading the appl context?
--

-- 
Posted via http://www.ruby-forum.com/.
Cyril Mougel | 30 May 09:28

Re: db:create gives "Unknown database"

On Fri, May 30, 2008 at 2:49 AM, Arun Gupta <arun.gupta <at> gmail.com> wrote:
>> Okay this is plain silly,
> Sorry, but not working for me :(
>
>>
>> what does your config/database.yml show?
>
> It is the one bundled with Typoe 5.0.3 and shown here:
>
> login: &login
>  adapter: mysql
>  host: localhost
>  username: root
>  password:
>
>
> development:
>  database: typo_dev
>  <<: *login
>
> test:
>  database: typo_tests
>  <<: *login
>
> production:
>  database: typo
>  <<: *login
>
>>
>> Which Adapter are you using SQLite3? MySQL?
(Continue reading)

Arun Gupta | 30 May 15:25

Re: db:create gives "Unknown database"

>>>
>>> Which Adapter are you using SQLite3? MySQL?
>> MySQL with JRuby
>
> With JRuby, I think that the Mysql adapter doesn't work. You need use
> : jdbcmysql
>
> Test with change the line adapter : mysql by adapter : jdbcmysql
> and install the gems jdbc-mysql activerecord-jdbcmysql-adapter.
MySQL Ruby adapter has always worked for me on Mac OS X.

As I said above,

~/testbed/jruby-1.1.2/bin/jruby -S rails foo -d mysql
cd foo
~/testbed/jruby-1.1.2/bin/jruby -S rake db:create

creates foo_development database for me. Why do I have to create it
explicitly for Typo ?

-Arun

>
>
> --
> Cyril Mougel
> http://blog.shingara.fr
> _______________________________________________
> Typo-list mailing list
> Typo-list <at> rubyforge.org
(Continue reading)


Gmane