Postgres does Katalon find the suitable one?

Hello, can someone please illuminate a key issue which we haven’t seen covered in the standard documentation or the other posts related to Katalon/postgres database testing:

We keep getting an error of No suitable driver found for jdbc postgres…

Route 1
Using the Katalon menu wizard, Project → Settings → Database, and following the format jdbc:postgresql://localhost:5432/DB_NAME?currentSchema=SCHEMA with our own variables, when we click Test Connection we see – Connection failed! No suitable driver found for jdbc:postgres://ourdburl:5432/ourtable?currentSchema=public

We’ve downloaded the postgresql-42.2.5.jar file and added it to the Settings → External Libraries input. It seems that we are using Java 8, but I think Katalon might be compiling with a jre7 postgres file by default.

Route 2
We created a custom keyword based on a youtube video for mysql (Database testing using custom keyword in Katalon Studio - YouTube). Error message follows our script below.

****Basically, when we “import” something (how do we know what to import also), do we need that library in a directory folder or how is that import facilitated? and how do we set this up for postgres if the Settings wizard isn’t working? We also put the postgresql-42.2.5.jar file in the Katalon → configuration → resources → lib folder.

package pgConnection

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable
import groovy.sql.Sql
import java.sql.*
import org.postgresql.Driver

public class ExecutingFirstQueryInSql {
	public connection(String url, String user, String password, String driverClassName){
		def sqlConnection = Sql.newInstance(url,user,password,driverClassName)
		sqlConnection.eachRow("Show tables") { row ->
				println row[0]

We created a test, called pgConnection.ExecutingFirstQueryInSql.connection, and added our variables to the Input dialog (jdbc:postgres:// for url) and then for driverClassName we temporarily inserted com.mysql.jdbc.Driver and also tried org.postgresql.jdbc.* and org.postgresql.Driver


Test Cases/QApg FAILED.
org.codehaus.groovy.runtime.InvokerInvocationException: java.sql.SQLException: No suitable driver found for jdbc:postgres://
at pgConnection.ExecutingFirstQueryInSql.invokeMethod(ExecutingFirstQueryInMySql.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(
at com.kms.katalon.core.main.TestCaseExecutor.runScript(
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(
at com.kms.katalon.core.main.TestCaseExecutor.execute(
at com.kms.katalon.core.main.TestCaseMain.runTestCase(
at com.kms.katalon.core.main.TestCaseMain.runTestCase(
at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:postgres://
at pgConnection.ExecutingFirstQueryInSql.connection(ExecutingFirstQueryInSql.groovy:27)
at pgConnection.ExecutingFirstQueryInSql.invokeMethod(ExecutingFirstQueryInSql.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(
… 11 more

The ql part was missing in the error message. Could you please try adding it and connect again?

Thank your good eyes! That did it.

1 Like