Guest User

Untitled

a guest
May 3rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. Edit your $GROOVY_HOME/conf/groovy-start.conf and add the following line:
  2.  
  3. load !{user.home}/.groovy/grapes/**.jar
  4.  
  5. After that your @Grab will work as advertised:
  6.  
  7. #!/usr/bin/env groovy
  8. @Grab(group='mysql', module='mysql-connector-java', version='5.1.12')
  9.  
  10. import groovy.sql.Sql
  11.  
  12. def sql = Sql.newInstance("jdbc:mysql://hostname/database", "username", "password", "com.mysql.jdbc.Driver")
  13. sql.firstRow("select * from users where id=1")
Add Comment
Please, Sign In to add comment