Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import groovy.sql.Sql
- buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.microsoft.sqlserver:mssql-jdbc:6.4.0.jre8'
- }
- configurations.classpath.each { Sql.classLoader.addURL it.toURI().toURL() }
- }
- task somethingWithMSSQL() {
- def dbHost = "host"
- def dbPort = "1433"
- def dbUsername = "username"
- def dbPassword = "password"
- def dbName = "database"
- def dbDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
- def jdbcUrl = "jdbc:sqlserver://$dbHost:$dbPort;databaseName=$dbName"
- def sql = Sql.newInstance(jdbcUrl, dbUsername, dbPassword, dbDriver)
- // do something with MSSQL
- sql.close()
- }
Add Comment
Please, Sign In to add comment