Eddard Stark
Eddard Stark

Reputation: 3595

Cannot connect to mysql from grails

I am using wamp server, it comes with mysql 5.5.16 and I am trying use the mysql from grails 1.3.7. In my Buildconfig.groovy file i have added "runtime 'mysql:mysql-connector-java:5.1.6'" under dependencies and my datasource.groovy looks like this:

dataSource {
        dbCreate = "create-drop" // one of 'create', 'create-drop','update'
        pooled = true
        driverClassName = "com.mysql.jdbc.Driver"
        username = "root"
        password = ""
        url = "jdbc:mysql://localhost:3306/moviestore_dev"
    }

but when i refresh dependencies or run the app, i get error=>
:: mysql#mysql-connector-java;5.1.6: not found

I can connect to the database but the data in the database remains as long as the app is running, the next time I run the app, all the data are gone ! I have no idea what is happening, please help ! Thanks

Upvotes: 0

Views: 1394

Answers (1)

Aram Arabyan
Aram Arabyan

Reputation: 2359

problem is in dbCreate = "create-drop"

use dbCreate = "update"

• create-drop: Drops and re-creates the database schema on each application load

• create: Creates the database on application load

• update: Creates and/or attempts an update to existing tables on application load

• [blank]: Does nothing

Upvotes: 1

Related Questions