Last active
April 12, 2017 07:29
-
-
Save DerSchimi/a0a420c27d034e43cf52b21d1843f242 to your computer and use it in GitHub Desktop.
groovy jdbc oracle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. download ojdbc7.jar (http://bugmenot.com/view/oracle.com) | |
2. script oracle.groovy: | |
def host = "host" | |
def port = "1521" | |
def db = "dbname" | |
def url = "jdbc:oracle:thin:@"+host+":"+port+":"+db | |
def username = "username" | |
def password = "password" | |
@GrabConfig(systemClassLoader=true) | |
driver = "oracle.jdbc.driver.OracleDriver" | |
import groovy.sql.* | |
sql = Sql.newInstance(url,username,password,driver); | |
sql.eachRow('''select table_name from all_tables | |
''', { link -> | |
println link | |
}) | |
3. groovy -cp ojdbc7.jar oracle.groovy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment