Working with Databases and Groovy
Working with Databases and Groovy
Dr Paul King
Groovy Lead for Object Computing Inc.
@paulk_asert
Contents
? groovy.sql.Sql ? Connecting to a database ? Writing to a database ? Reading from a database ? Stored Procedures ? Advanced Reading/Writing
? groovy.sql.DataSet ? MongoDB ? Neo4j
2
groovy.sql.Sql
? Groovy-friendly higher-level API sitting over JDBC
3
Connecting to a database...
? Sql.newInstance
import groovy.sql.Sql
def url = 'jdbc:hsqldb:mem:marathon' def user = 'sa' def password = '' def driver = 'org.hsqldb.jdbcDriver' def sql = Sql.newInstance(url, user, password, driver)
// use 'sql' instance
sql.close()
? assumes driver is on the classpath ? other newInstance variants available
4
...Connecting to a database...
Advanced
? Some variations
@Grab('org.hsqldb:hsqldb:2.3.3')
@GrabConfig(systemClassLoader=true)
def sql = Sql.newInstance(
import groovy.sql.Sql
url: 'jdbc:hsqldb:mem:marathon',
// ...
user: 'sa',
password: '',
driver: 'org.hsqldb.jdbcDriver',
cacheStatements: true,
resultSetConcurrency: CONCUR_READ_ONLY
)
Sql.withInstance(url, user, password, driver) { // use 'sql' instance
} // no close() required
5
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- embedded sql in rpg beyond the basics
- sql server execute statement with result set clause
- using vfp 9 s sql commands
- built in sql functions drexel university
- advanced sql cursors stored procedures
- a two step sql query with the execute function
- claris filemaker sql reference guide
- working with databases and groovy
- call execute let your program run your macro
- installshield tip accessing the msi database at run time
Related searches
- word for working with someone
- working with others synonym
- synonym for working with others
- synonym for working with people
- word for working with others
- working with people synonym
- interview question working with others
- another word for working with others
- working with toddlers interview questions
- working with teens with autism
- working with preschoolers with autism
- working with people with dementia