Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public static void main(String[] args) {
  2.  
  3. GroovyShell shell = new GroovyShell();
  4.  
  5. String script = "";
  6.  
  7. script = ""
  8. + "def url ='jdbc:oracle:thin:@localhost:1521:XE';"
  9. + "def user = 'x';"
  10. + "def pass= 'X';"
  11. + "def driver = 'oracle.jdbc.pool.OracleDataSource';"
  12. + "def sql = groovy.sql.Sql.newInstance(url, user, password, driver); "
  13. + "sql.eachRow('select id from dec_rt_decision'){"
  14. + "it-> println('My row number is: ${it.count}');"
  15. + "};"
  16. + "sql.close();"
  17. + "println(result);";
  18.  
  19. shell.evaluate(script);
  20.  
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement