Katalon Script for postgres connection using sslcert, sslkey file path is not working with latest version V7.9.1 but working with old version 7.4.0

Background:
I have an existing script which will run postgres sal queries with pustgressql-42.2.16.jar external dependency which is working in katalonstudio V7.4.0 when i run from a windows os laptop.
This script is connecting to sql using sslcert, and sslkey file path. The Katalon new version V7.9.0 and V7.9.1, this is not working , where as Katalon V7.4.0 my script is still working. So its for sure Katalon specific settings issue with path or something with new version. So, could you please help me here??

Error with Katalon V7.9.1:
Exception : org.postgresql.util.PSQLException: Could not open SSL certificate file ‘C:/…\cert\filename.crt’

Tries converting the RunConfiguration.getProjectDir() path / to , then also same error
Exception : org.postgresql.util.PSQLException: Could not open SSL certificate file ‘C:…\cert\filename.crt’

Reason:
java.lang.NullPointerException: Cannot invoke method size() on null object
at DeleteAllRecordsOfOrg.run(DeleteAllRecordsOfOrg:31)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase…

// Initial set method
url = “jdbc:postgresql://”+GlobalVariable.db_host+":"+GlobalVariable.db_port+"/"+GlobalVariable.db_name;

properties = new Properties();
properties.put( “user”, user );
properties.put( “password”, pw );
properties.put( “sslmode”, GlobalVariable.db_ssl_mode );

properties.put( “sslcert”, “’” + RunConfiguration.getProjectDir() + File.separator + “Data Files” + File.separator; + “cert” + File.separator + GlobalVariable.certFile + “’” );
properties.put( “sslkey”, “’” + RunConfiguration.getProjectDir() + File.separator + “Data Files” + File.separator; + “cert” + File.separator + GlobalVariable.keyFile + “’”);

// postgres sql connection with properties:
public void executeSQL( String sql ) throws ClassNotFoundException, SQLException {
Class.forName( “org.postgresql.Driver” );

	try {
		Connection connection = DriverManager.getConnection( url, properties )
		Statement stmt = connection.createStatement();
		stmt.execute( sql );
		connection.close();
	}catch(Exception e){
		// handle exception
		println('Exception : ' + e)
		return null;
	}
}

After resetting project settings with new version V7.9.1, It started working fine, Hence we can close this ticket

1 Like