oracle sqldeveloper - How do you read data like tables from SQL Developer using Grails? -
i have fair amount of knowledge of grails cannot find way how read data table sql developers using grails. how can this?
by default when use run-app
, database in-memory (the url "jdbc:h2:mem:devdb"), there's no way connect outside jvm. if change "real" database can connect both grails , client.
to h2, 1 option start standalone server. requires find h2 jar - under $home/.m2/repository or $home/.grails/ivy-cache. example on machine command start on port 9092 (the default) is
java -cp /home/burt/.m2/repository/com/h2database/h2/1.3.170/h2-1.3.170.jar org.h2.tools.server -tcp -tcpport 9092
then change url in grails-app/conf/datasource
to
url = 'jdbc:h2:tcp://localhost:9092/dbname'
where "dbname" arbitrary - h2 supports creating multiple databases per server. can start grails , connect server, , can connect client too.
a simpler way use h2's auto-server mode, e.g. url
url = 'jdbc:h2:./dbname;auto_server=true;auto_server_port=9092'
it start in-memory database tcp socket on port 9092 can connect externally. avoids having find jar , explicitly start database server.
see http://h2database.com/html/main.html more configuration information.
you can use different server, e.g. mysql/postgresql/oracle/etc server.
but having said this, there convenient database client running can access. when start grails run-app
can connect http://localhost:8080/appname/dbconsole
in web browser , access table information, sql queries, etc. h2 feature, works whatever database use since works jdbc, can use mysql or whatever. see http://grails.org/doc/latest/guide/conf.html#databaseconsole more information on this.
Comments
Post a Comment