How can i fix the "Cannot cast object" error

Can someone guide me on how can i fix this error,

Cannot cast object 'com.mysql.cj.jdbc.ConnectionImpl@2c444798' with class 'com.mysql.cj.jdbc.ConnectionImpl' to class 'org.postgresql.jdbc.PgConnection'
2023-11-06 20:03:38.489 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/New Test Case FAILED.
Reason:
com.kms.katalon.core.exception.StepErrorException: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.mysql.cj.jdbc.ConnectionImpl@2c444798' with class 'com.mysql.cj.jdbc.ConnectionImpl' to class 'org.postgresql.jdbc.PgConnection'
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.throwError(CustomKeywordDelegatingMetaClass.java:101)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:73)
	at New Test Case.run(New Test Case:12)
	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:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1699281211826.run(TempTestCase1699281211826.groovy:25)
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.mysql.cj.jdbc.ConnectionImpl@2c444798' with class 'com.mysql.cj.jdbc.ConnectionImpl' to class 'org.postgresql.jdbc.PgConnection'
	at db.subscription.connectDB(subscription.groovy:27)
	at db.subscription.invokeMethod(subscription.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:55)
	... 12 more

Hi Rajesh, :wave:

Welcome to Katalon Community.

Could you give us more information to what you were trying to do within Katalon Studio i.e. screenshot, video, etc.?

We need to see the “casting statement” that you are using to see what you are doing incorrectly. Can you show us that?

Hi @m.mailtorajesh

i hope this will help you