Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dbName = 'icpar'
- def db = [url : "jdbc:mysql://localhost:3306/$dbName?autoReconnect=true&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull",
- user : 'root',
- password: 'pass',
- driver : 'com.mysql.jdbc.Driver']
- Sql sql = Sql.newInstance(
- db.url,
- db.user,
- db.password,
- db.driver)
- def attachements = sql.rows("SELECT p.payment_attachment FROM paymment p LIMIT 10,15")
- withPool {
- attachements.each {
- println(it.payment_attachment)
- String url = it.payment_attachment
- def f = new File("E:\\PROJECTS\\Exporter\\src\\main\\groovy\\com\\omnitech\\fileParser\\downloaded\\${url.substring(url.lastIndexOf('/') + 1)}")
- new URL(url).withInputStream { i -> f.withOutputStream { it << i } }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement