Ask a Question

active database connection

VGaur
Contributor

active database connection

Hello, 

 

Like getActiveEnvironmentName() , is there a way to get the active database connection string? 

I have a script external to soapui tool and I call that script using groovy and pass (testRunner,Context and log) to it.

I am using "com.eviware.soapui.support.GroovyUtilsPro(context)" class to establish connection.

 

I want to see the connection details in this context. 

 

Cheers

 

2 REPLIES 2
nmrao
Community Hero

Re: active database connection

How do you got this thought?
Do you know if the connection can be retrieved in any of the steps other than jdbc step within soapui? Then we can think of external script.

In short, the answer is not possible, IMO.


Regards,
Rao.
VGaur
Contributor

Re: active database connection

Hey nmrao, 

 

You are right except for JDBC step, knowing what db connection you are working on doesn't make sense. 

But you can set and inquire the connection using groovy script. That's what I want to know - I am passing the context,testRunner,log to my external script and setting up database connections using the physical name of the connection defined in ReadyAPI tool. Some of my test cases are failing and I suspect that sql query that executes in the external script does not point to correct database and I want to know whether the connections I am setting are actually good or not. 

 

1. I have tried to query databasecontainer class but because I m using "testRunner" to access it gives me the default connection setup against my service and not what I am pointing to.

 2. def conn= utils.getJdbcConnection("physical Name of connection") , checked Connection Interface (http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html?is-external=true)

it doesn't exposed any method that would let me pull out the connection string.

 

 

At last the only workaround that I have put in place is get the activeEnvironment in the external script and set it again using setActiveEnvironment.

 

Please let me know if you have any question.

 

Cheers

cancel
Showing results for 
Search instead for 
Did you mean: