What happened to groovy.sql.Sql?

I have been using import groovy.sql.Sql

@Keyword
def static void insertOpsForDD() throws ClassNotFoundException, SQLException {
def sql = Sql.newInstance(GlobalVariable.DB_AACCES_URL, GlobalVariable.DB_USER_KATALON, GlobalVariable.DB_PASS_KATALON, ‘oracle.jdbc.driver.OracleDriver’)

		sql.connection.autoCommit = false
		def sqlstr = """
	 Insert into AACCES.DEPOSITS_DISBURSEMENTS... not showing rest of sql....)
	 """
		try {
			sql.execute(sqlstr);
			sql.commit()
			int rows = sql.updateCount
			println("rows inserted = " + rows)
			println("Successfully committed")
		}
		catch(Exception ex) {
			sql.rollback()
			println("Transaction rollback")
		}
		sql.close()
	}

I am not able to compile the code anymore.
How can I get this library back and my code working?

1 Like

Which version of Katalon Studio are you using? v8.x.x or v9.x.x-beta?

v9.x.x changed the Groovy version; so the package groovy.sql.Sql might have moved somewhere you do not know. You should try going backward to the v8.6.x

We need Katalon staff to look at this.

@vu.tran

I am using v9.

Where is link to download and use 8.6?

2 Likes

Hi @philippe.novikov,

Here is a workaround that you can try for 9.0.0.beta:

  1. Go to this link
  2. Download the jar file
  3. Open KS and go to Project Settings > Library Management, then add the downloaded jar file to the External Libraries.
  4. Apply and Close.

Hope it can work for you :grin:

Thank you! Its working now.