Ask a Question

Connecting to postgres Cloud DB with SSL enabled

SOLVED
venkates
New Contributor

Connecting to postgres Cloud DB with SSL enabled

Hello All

 

I am planning to store my test results in postgres Cloud DB. Cloud DB accepts connection only with SSL enabled. 

 

I have tried below configuration . Same configuration works fine with plain java program but not with groovy.

 

Any suggestions ?

 

Map batchDBConnParams = [
ssl: 'true',
sslmode: 'verify-ca',
sslrootcert: 'D:\\venkat\\automation\\postgres\\pg_badge.cert',
user:'XXXXXX',
password:'XXXXX',
url:'jdbc:postgresql://cloudURL:32681/DB_name',
driver: 'org.postgresql.Driver',
sslfactory:'org.postgresql.ssl.NonValidatingFactory'  // This i have added based on some other topic suggestion .
]

3 REPLIES 3
sonya_m
SmartBear Alumni (Retired)

Any idea what could be going on here ?

 

@HimanshuTayal @richie @groovyguy @nmrao 


Sonya Mihaljova
Community and Education Specialist

Everything is working fine in java program . but not on readyapi.

 

Please find the full code below .. I was seeing in some other post that it was working in previous version and not in 3.2.0 version.

 

import groovy.sql.*
import com.eviware.soapui.impl.wsdl.support.wss.crypto.CryptoType
import com.eviware.soapui.settings.SSLSettings
import com.eviware.soapui.SoapUI


def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)

com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( driver )


def keystorePath = "D:\\XX\\XX\\XX\\cert\\ibm_cloud_db.jks"

// set
SoapUI.settings.setString( SSLSettings.KEYSTORE, keystorePath )
SoapUI.settings.setString( SSLSettings.KEYSTORE_PASSWORD, "XXXXX!" )

// get
log.info (SoapUI.settings.getString( SSLSettings.KEYSTORE, "value to return if there is no such setting set" ))

 

Map batchDBConnParams = [
ssl: 'true',
sslmode: 'verify-full',
user:'XXXXX',
password:'XXX',
url:'jdbc:postgresql://XXXXXX:32681/XXXX',
driver: 'org.postgresql.Driver'
]


// Connect to the SQL instance.
//def conn = Sql.newInstance(url, user, password, driver)
def dbConnection = Sql.newInstance(batchDBConnParams);

If that is the case, then open a ticket SmartBear customer care.
Mean while use previous version which is working for you.



Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: