cancel
Showing results for 
Search instead for 
Did you mean: 

[Res] DB Connection string is not updated when changing env

SiKing
Community Expert

Re: [Res] DB Connection string is not updated when changing

I take that back: there is still a problem! I am not sure exactly where the problem is though.


  1. create a project

  2. create a JDBC connection

  3. create an Environment

  4. create a test that used the JDBC connection

  5. verify everything is working, save everything, exist SoapUI (just in case)

  6. create another Environment

  7. run the testcase against this new environment

  8. the JDBC step never gets executed, the testcase stops at that point with the below errors

  9. the workaround that I have found: you need to open and close every single JDBC step



  10. 2013-11-01 13:10:46,913 INFO [SoapUIProTestCaseRunner] Running soapUI testcase [createClientKey TestCase]
    2013-11-01 13:10:46,913 INFO [SoapUIProTestCaseRunner] running step [check validateHash]
    2013-11-01 13:10:47,283 INFO [SoapUIProTestCaseRunner] Assertion [Not SOAP Fault] has status VALID
    2013-11-01 13:10:47,283 INFO [SoapUIProTestCaseRunner] Assertion [EXISTS validateHash] has status VALID
    2013-11-01 13:10:47,283 INFO [SoapUIProTestCaseRunner] running step [retrieve appSignatureHash]
    2013-11-01 13:10:49,723 ERROR [SoapUI] An error occured [Communications link failure

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.], see error log for details
    2013-11-01 13:10:49,723 ERROR [errorlog] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:350)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2408)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2445)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2230)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)
    at com.eviware.soapui.support.GroovyUtils$DriverProxy.connect(GroovyUtils.java:171)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.eviware.soapui.support.jdbc.JdbcUtils.initConnection(JdbcUtils.java:68)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.getDatabaseConnection(JdbcSubmit.java:218)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.prepare(JdbcSubmit.java:261)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.runQuery(JdbcSubmit.java:197)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.run(JdbcSubmit.java:161)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.<init>(JdbcSubmit.java:75)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcRequest.submit(JdbcRequest.java:135)
    at com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep.run(JdbcRequestTestStep.java:205)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:239)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:148)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:43)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.net.UnknownHostException: unused
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source)
    at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
    at java.net.InetAddress.getAllByName0(Unknown Source)
    at java.net.InetAddress.getAllByName(Unknown Source)
    at java.net.InetAddress.getAllByName(Unknown Source)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:249)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
    ... 34 more
    2013-11-01 13:10:49,793 INFO [SoapUIProTestCaseRunner] Assertion [JDBC Status] has status UNKNOWN
    2013-11-01 13:10:49,793 INFO [SoapUIProTestCaseRunner] Assertion [VERIFY md5] has status UNKNOWN
    2013-11-01 13:10:49,793 ERROR [SoapUIProTestCaseRunner] retrieve appSignatureHash failed, exporting to [C:\Users\XXX\workspace\das-war-test\soapui\results\DeviceAuth_Smoke_TestSuite-createClientKey_TestCase-retrieve_appSignatureHash-0-FAILED.txt]
    2013-11-01 13:10:49,803 ERROR [SoapUIProTestCaseRunner] Error saving failed result: java.lang.NullPointerException
    java.lang.NullPointerException
    at java.io.StringReader.<init>(Unknown Source)
    at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:708)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:696)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:683)
    at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208)
    at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:580)
    at com.eviware.soapui.support.xml.XmlUtils.createXmlObject(XmlUtils.java:263)
    at com.eviware.soapui.support.XmlHolder.<init>(XmlHolder.java:38)
    at com.eviware.soapui.impl.wsdl.teststeps.JdbcTestStepResult.writeTo(JdbcTestStepResult.java:224)
    at com.eviware.soapui.tools.SoapUITestCaseRunner.afterStep(SoapUITestCaseRunner.java:722)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:251)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:148)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:43)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    2013-11-01 13:10:49,823 INFO [SoapUIProTestCaseRunner] Finished running soapUI testcase [createClientKey TestCase], time taken: 2870ms, status: FAILED


    I have a new environment, but no workaround for this.
SiKing
Community Expert

Re: [Res] DB Connection string is not updated when changing

I just tried it with a clean project with SoapUI-Pro 4.6.1. This is definitely still broken!

If I go further, and use the workaround as above (open and close the JDBC step) and then try to run against the previous environment it uses the updated credentials. The workaround mentioned in my reply way above still works tho'.

You can confirm this by using composite project. Set everything up as I mentioned. When you exist SoapUI in step 5, backup the test file. When you perform the workaround in step 9, exit again. Compare the two test files - you will notice everything inside is hard-wired!!!
benonline
New Contributor

Re: [Res] DB Connection string is not updated when changing

Here at Topicus Finan we also have this issue and I have created a workaround for it with help of Groovy.

On all suite levels inside the 'Setup script' tab I added the following Groovy script.


// Get first databaseName.
databaseName = testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionAt(0).getName()

// Get connectionString of active environment.
connectionString = testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getConnectionString()

// Iterate all testcases in the suite.
for(testCase in testSuite.getTestCaseList())
{
// Iterate all test steps in the test case and change connectionString for all ProJdbcRequestTestStep to the selected environment connectionString.
for(testStep in testCase.getTestStepList())
{
// Set the connectionString for all ProJdbcRequestTestStep
if(testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep)
{
testStep.setConnectionString(connectionString)
}
}
}


And on test case levels inside the 'Setup script' tab I added the following Groovy script.


// Get first databaseName.
databaseName = testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionAt(0).getName()

// Get connectionString of active environment.
connectionString = testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getConnectionString()

// Iterate all test steps in the test case and change connectionString for all ProJdbcRequestTestStep to the selected environment connectionString.
for(testStep in testCase.getTestStepList())
{
// Set the connectionString for all ProJdbcRequestTestStep
if(testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep)
{
testStep.setConnectionString(connectionString)
}
}


Now when you switch from environment inside a suite or test case the setup script will automatically set the correct connection string based on the configured JDBC inside the enviroment tab of the working project.

Regards, Ben.
benonline
New Contributor

Re: [Res] DB Connection string is not updated when changing

A better workaround could be to add almost the same code inside the project 'Event' tab and then for the event name TestRunListener.beforeRun:


// Get first databaseName.
databaseName = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionAt(0).getName()

// Get connectionString of active environment.
connectionString = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getConnectionString()

// Iterate all test steps in the test case and change connectionString for all ProJdbcRequestTestStep to the selected environment connectionString.
for(testStep in context.testCase.getTestStepList())
{
// Set the connectionString for all ProJdbcRequestTestStep
if(testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep)
{
testStep.setConnectionString(connectionString)
}
}


Then for every test case the connectionString will be set correctly, this will make my last workaround not necessary to configure it separately for every test suite and test case.
MarcusJ
Moderator

Re: [Res] DB Connection string is not updated when changing

Hi All,

Thank you for your investigation into this problem.
This issue has been noted and a defect has been opened.
SOAP-1013 is being used to track this issue.


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
shamane2000
Occasional Contributor

Re: [Res] DB Connection string is not updated when changing

Hi, is there any good news regarding this issue?
In this post (http://forum.loadui.org/viewtopic.php?f=2&t=23945&hilit=1210&sid=290acd8c9e676966fbdd1d9569c9c383 ) I have read something about this issue too (SOAP-1210).

PS: Where can i see the state of this ticket numbers? Is there a public access to JIRA or something?

With best regards,
Shamane
nuv7
Occasional Contributor

Re: DB Connection string is not updated when changing env

Hello,

 

I am using Ready API 2.8 and I am having the same problem.  Anyone know how to solve this problem?

 

Thank you for your help.

sonya_m
Community Manager

Re: DB Connection string is not updated when changing env

Hi @nuv7,  have you tried using workarounds suggested in this thread 

 

I’ve also checked our DB and see that this issue was fixed in version 2.6, so it is supposed to work fine.

Your case definitely requires deeper investigation, please contact support and provide them with the details of your issue, thank you.  


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors