cancel
Showing results for 
Search instead for 
Did you mean: 

Close JDBC connections following JDBC datasource step

Highlighted
Occasional Contributor

Close JDBC connections following JDBC datasource step

Hi all,

 

We have built a set of test cases that follow the steps below:

 

1. JDBC DataSource Step - this step connects to our database and pulls back a set of data that we will use in our request message

2. REST Request Step - using the first value returned from the above JDBC DataSource step, we will send a request to the REST service and assert the values against our expected result

3. DataSource Loop - loops back to step 1 to pick up the next input value

 

However, we have found that the connection to the database that is established in step 1 is never closed. Our databases have session limits, which means that we quickly bring down our databases and require a database restart in order to continue.

 

Is there a way to ensure that the database connections are closed, either after step 1 has run or at the end of the test?

 

Thanks in advance for your help.

 

Matt

5 REPLIES 5
Highlighted
Community Hero

Re: Close JDBC connections following JDBC datasource step

hi,

 

what RDBMS is it?  I know Oracle has a kill session SQL command (I've used it before) - you can run this in theJDBC step (although the user you are using in your connection will need appropriate privileges to enable you to run the kill session command successfully)

 

I had a quick search for SQL Server and found the following here

 

I found the following for DB2 here

 

dont know if any of this helps, but I have done it outside SoapUI using SQL for DB2, ,SQL Server and Oracle although its been a while

 

cheers,

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Highlighted
Community Hero

Re: Close JDBC connections following JDBC datasource step

Isn't the connection closed even after soapUI is closed?


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Close JDBC connections following JDBC datasource step

Hi Richie, and thanks for the reply.


Apologies, I should have mentioned that. It's an Oracle database.

 

From what I can tell, in the JDBC step I can only enter one query/command. So I'd have to create a new JDBC step to run the KILL SESSION command, which would kill that session and leave the first one open. 

Highlighted
Occasional Contributor

Re: Close JDBC connections following JDBC datasource step

From my initial investigations - no. The session only seems to be killed if I go into the DB and kill the session via the SYSTEM user. I'll do some more checking of this though to make sure that's exactly what's happening

Highlighted
Community Hero

Re: Close JDBC connections following JDBC datasource step

Looking at the code and the connection gets closed once the response is received.

https://github.com/SmartBear/soapui/blob/dbe7cab5dec46e5a511257ca31648e093404a23c/soapui/src/main/ja...


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors