I have the following code where on 7.8.2 version runs smoothly but on 8.1.0 throws exception:Could not create connection to database server.
Any ideas?
package dataBaseConnection
import java.sql.DriverManager
import java.sql.ResultSet
import java.sql.Statement
import com.kms.katalon.core.annotation.Keyword
import java.sql.Connection
import internal.GlobalVariable
public class DataBaseConnection {
static host="host.net"
static port='3333'
static username='user'
static password= 'pass'
/**
* Open and return a connection to database
* @param dataFile absolute file path
* @return an instance of java.sql.Connection
*/
//Establishing a connection to the DataBase
def connectDB(String dbName){
java.sql.Connection connection
//Load driver class for your specific database type
String timezone ="?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"
String conn = "jdbc:mysql://" + host + ":" + port + "/" + dbName+timezone
if(connection != null && !connection.isClosed()){
connection.close()
}
connection = DriverManager.getConnection(conn, username, password)
return connection
}
//Closing the connection
def closeDatabaseConnection(Connection connection) {
if(connection != null && !connection.isClosed()){
connection.close()
}
connection = null
}