Forum Discussion

pgm33's avatar
pgm33
New Contributor
4 years ago
Solved

JDBC request is failing ramdomly

Hi All!

I hope you can help me. I created a test case with this test steps:

I created a JDBC test step (check document status) with a query that checks that the document was created successfully in the database, but sometimes when I ran the test it fails, not always. I thought that if I execute the same query but in a Groovy script (check document status 2) it might work but the same thing is happening.

 

If I ran manually the step that fail it works. 

What could be happening?  

 

Thanks in advance!

 

 

  • Hey pgm33,

    Ive had what appears to be the same issue on several different occasions and without knowing any more about your technical architecture im guessing its latency that is the problem (or at least that was the cause of when i had the same issues).
    Essentially (on my system) my SQL was firing too soon after the REST request that created the record had completed and the RDBMS hadnt completed the record creation transaction under the covers.

    I solved my issue by adding a Delay step in between the REST step and the JDBC step. The pause i added in was between 2 and 5 seconds depending on the technical architecture.
    For example, if your REST endpoint is actually proxying the request (like via an ESB or API gateway which is occasionally called a "facade" step) before hitting the listening RDBMS webservice this was adding a little delay in the transaction. Ive even had this delay even when my endpoint wasnt a facade/proxy.

    In summary: chuck in a delay of about 5 seconds and see if failure stops manifesting.

    Ta

    Rich

2 Replies

  • richie's avatar
    richie
    Community Hero
    Hey pgm33,

    Ive had what appears to be the same issue on several different occasions and without knowing any more about your technical architecture im guessing its latency that is the problem (or at least that was the cause of when i had the same issues).
    Essentially (on my system) my SQL was firing too soon after the REST request that created the record had completed and the RDBMS hadnt completed the record creation transaction under the covers.

    I solved my issue by adding a Delay step in between the REST step and the JDBC step. The pause i added in was between 2 and 5 seconds depending on the technical architecture.
    For example, if your REST endpoint is actually proxying the request (like via an ESB or API gateway which is occasionally called a "facade" step) before hitting the listening RDBMS webservice this was adding a little delay in the transaction. Ive even had this delay even when my endpoint wasnt a facade/proxy.

    In summary: chuck in a delay of about 5 seconds and see if failure stops manifesting.

    Ta

    Rich