Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] sql.execute() use of a .sql file problem

Jason mayer

2010-02-05

Replies: Find Java Web Hosting

Author LoginPost Reply
Groovy Version: 1.7.0 JVM: 1.6.0_18
mysql-connector-java-3.1.14-bin.jar

import groovy.sql.Sql
def getConn() {
def sql = Sql.newInstance("jdbc:mysql://localhost:3306/aaa", "bbb",
"bbb", "com.mysql.jdbc.Driver")
sql
}
def sql = getConn()

def setupAllTables(sql) {
"mysql -ubbb -pbbb aaa < createdb.sql".execute().waitFor() //does
nothing, if I run that from the command line it works correctly.
sql.execute("source /my/path/to/the/file/createdb.sql") //fails,
works from a mysql prompt
}

I'm trying to set up a known working set of data in the database
during my startup script due to a bug I spent far too long
troubleshooting. How do I do this from within groovy?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.