Forum Discussion

m_atty's avatar
m_atty
Occasional Contributor
6 years ago

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

  • richie's avatar
    richie
    Community Hero

    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

    • m_atty's avatar
      m_atty
      Occasional Contributor

      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. 

  • nmrao's avatar
    nmrao
    Champion Level 3
    Isn't the connection closed even after soapUI is closed?
    • m_atty's avatar
      m_atty
      Occasional Contributor

      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