grails - Running H2 script tools -


i'm running grails 2.3.3 'in-memory' h2 database in windows environment.

i'm trying use command line tools such script in order take backups of data table.

i've located jar file:

c:\program files\springsource\grails-2.3.3\lib\hsqldb\hsqldb\jars\hsqldb-1.8.0.10.jar 

here command trying:

java -cp hsqldb-1.8.0.10.jar orgh2.tools.shell 

but error:

    'error: not find or load main class orgh2.tools.shell' 

here explanation of db configuration. have 2 dbs defined in config file datasource.groovy both use user sa blank password @ moment.

here key lines in datasource file:

datasource {             pooled = true             driverclassname = "org.h2.driver"             username = "sa"             password = "" }  hibernate {             cache.use_second_level_cache = true             cache.use_query_cache = false             cache.region.factory_class = 'net.sf.ehcache.hibernate.ehcacheregionfactory' }     datasource {     dbcreate = "update" // 1 of 'create', 'create-drop', 'update', 'validate', ''         url = "jdbc:h2:devdb;mvcc=true;lock_timeout=10000"     }  datasource_publish {     dbcreate = "update" // 1 of 'create', 'create-drop', 'update', 'validate', ''     url = "jdbc:h2:/dbmak/devdb;mvcc=true;lock_timeout10000;                     auto_server=true;db_close_on_exit=false" } 

because 'in-memory' configuration unable change sa password gets automatically reset blank value when grails application restarted.

i found java jar in : grails-2.3.3\lib\com.h2database\h2\jars.

so command is: java -cp h2-1.3.173.jar org.h2.tools.shell

if asked interactively input set of responses in order target database - is: "

"driver", "database", "login user , password.  

the password blank , requires me press rtn twice before connection achieved.

i have been able go 1 of dbs (jdbc:h2:/dbmak/devdb) not other , able run sql command.

however , if try access db: jdbc:h2:devdb error:

'sql exception: wrong user name or password'.

which strange able access both dbs same user/password via dbconsole web session.

finally, i'm trying have set of scripts extract contents of each individual db tables separate files (possibly using -script option run separate file. ideally command line should without interaction - have tried use -url -driver -user , -password input parameters remove interactive part. unable of these options working yet.

welcome suggestions?

-mike


Comments