开发者

Grails Not Using Dev Database

I have a grails project and my configuration points to a mysql database:

DataSource.groovy
    environments {
        development {
            dataSource {
                dbCreate = "update"
                url = "jdbc:mysql://localhost/mydb"
                driverClassName = "com.mysql.jdbc.Driver"
                username = "root"
                password = "mypass"
                hibernate.dialect = "org.hibernate.dialect.MySQLDialect"
            } 
        }...

When Grails runs, (using grails dev run-app or grails run-app) it is not connecting to this development environment at all, but instead is using a default development environment. I know this because none of the data in the mydb database can be seen, and new entries into the db are not persisted in mydb. What am I doing wrong?

EDIT:

I ge开发者_如何学Pythont some error messages on startup that lead me to believe it is actually loading the right database:

2011-06-20 13:15:00,603 [main] ERROR hbm2ddl.SchemaUpdate  - Unsuccessful: alter table X add index FK9DBE53031937164 (a_id), add constraint FK9DBE53031937164 foreign key (a_id) references Y (id)
2011-06-20 13:15:00,607 [main] ERROR hbm2ddl.SchemaUpdate  - Can't create table 'mydb.#sql-2db_215' (errno: 150)

but see no indication that this would cause it to kick back to the default Grails environment or anything like that. Could this be related?

EDIT 2:

Config.groovy has the following:

environments {
    development
    {
        //Port
        grails.server.port.http = 9091

    }

but the application still runs on 8080.


This was actually my problem (user error). It was pointing correctly to the correct database, but a series of problems caused the information to be written to a spot that made it look like it wasn't being written. My fault! Thanks for the help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜