cancel
Showing results for 
Search instead for 
Did you mean: 

databaseConnectionContainer missing in groovy in readyapi?

SOLVED
Highlighted
Occasional Contributor

databaseConnectionContainer missing in groovy in readyapi?

Hi

I have an old soapui-proejct, that I am trying to bring to life again. I ahve installed readyAPI 3 and I get this error when I am trying to run my test:

Mon Jan 20 12:23:43 CET 2020: ERROR: An error occurred [No signature of method: com.eviware.soapui.impl.wsdl.support.connections.DefaultDatabaseConnectionContainer.getDatabaseConnectionByName() is applicable for argument types: (java.lang.String) values: [test]], see error log for details

 

My script has this line:

import groovy.sql.Sql

Class.forName("oracle.jdbc.driver.OracleDriver")
connection = testRunner.testCase.testSuite.project.databaseConnectionContainer.getDatabaseConnectionByName('test')

 

when I edit the script, I can see in the editor, that the "project" doesn't seem to have an entry for "databaseConnectionContainer" anymore. I just don't know what to change it to - I have searched all I can think of, for a fix. 

Any hints/pointers?

 

Thanks

  Jan

--
eliasen, representing himself and not the company he works for.
1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

Re: databaseConnectionContainer missing in groovy in readyapi?

I believe that I hit the same issue as you when I upgraded Ready API from 1.7 to version 2.8.2 (I'm not sure at what point the actual removal of the getDatabaseConnectionByName(java.lang.String) method happend).

 

I switched my Groovy Script to use the GroovyUtilsPro object to get the JDBC connection, something like the following code:

 

import com.eviware.soapui.support.GroovyUtilsPro

def groovyUtilsPro = new  GroovyUtilsPro(context)
def jdbcConnection = groovyUtilsPro.getJdbcConnection('YourConnectionName')

The GroovyUtilsPro object deals with working out if you are running in the environment mode or not and always returns the correct connection, which I also found very useful.

 

(Full disclosure, I don't actually use the getJdbcConnection() method as I was actually only using the connection to get a Groovy Sql object, the GroovyUtilsPro actually also provides a getGroovySql() method)

View solution in original post

3 REPLIES 3
Super Contributor

Re: databaseConnectionContainer missing in groovy in readyapi?

I believe that I hit the same issue as you when I upgraded Ready API from 1.7 to version 2.8.2 (I'm not sure at what point the actual removal of the getDatabaseConnectionByName(java.lang.String) method happend).

 

I switched my Groovy Script to use the GroovyUtilsPro object to get the JDBC connection, something like the following code:

 

import com.eviware.soapui.support.GroovyUtilsPro

def groovyUtilsPro = new  GroovyUtilsPro(context)
def jdbcConnection = groovyUtilsPro.getJdbcConnection('YourConnectionName')

The GroovyUtilsPro object deals with working out if you are running in the environment mode or not and always returns the correct connection, which I also found very useful.

 

(Full disclosure, I don't actually use the getJdbcConnection() method as I was actually only using the connection to get a Groovy Sql object, the GroovyUtilsPro actually also provides a getGroovySql() method)

View solution in original post

Highlighted
Community Manager

Re: databaseConnectionContainer missing in groovy in readyapi?

Thank you Radford.

@eliasen did you have a chance to try this approach? Do let us know. Thanks.



Sonya Mihaljova
Community and Education Specialist

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
Highlighted
Occasional Contributor

Re: databaseConnectionContainer missing in groovy in readyapi?

Thanks, @Radford :-)

 

That got me a step closer to a working script :-)

 

--
eliasen, representing himself and not the company he works for.