Forum Discussion

Nessie's avatar
Nessie
Occasional Contributor
12 years ago

Best way to connect to oracle DB

Hi Everyone,

Can I use SoapUI to connect to an oracle DB to do an update or do I need to use SoapUI Pro?

Many thanks..

7 Replies

  • deggial's avatar
    deggial
    Occasional Contributor
    1. Download appropriate driver - http://www.soapui.org/Working-with-soap ... -list.html (Oracle is there as well) and place it in SoapUI lib folder.

    2. Connect to db using script (be sure to change appropriate driver in the connection string, I don't have Oracle so I can't check it, but the mechanism is in place):

    import groovy.sql.Sql

    def sql = Sql.newInstance("jdbc:mysql://xx.xx.xx.xx:3306/dbname", "root", "password", "com.mysql.jdbc.Driver")

    sql.eachRow("SELECT * FROM myTable;") {
    log.info " ${it.id}"
    }
  • Nessie's avatar
    Nessie
    Occasional Contributor
    Hi,

    I have a number of WDSL's, these being:

    FLAuthWebBinding
    authenticate
    authenticateByProxy
    verify


    FLWebBinding
    updateIndividual (this is what I am using to do the DB update)

    Where would I put the groovy script?
  • deggial's avatar
    deggial
    Occasional Contributor
    You should choose location based on your scenario.

    If I understood correctly - it is the last step, so create a groovy script as last step and place there the query you want to execute.

    Edit: You can find information regarding working with databases in Groovy here - http://groovy.codehaus.org/Database+features
  • Nessie's avatar
    Nessie
    Occasional Contributor
    hey, me again..

    To make it a bit easier for me I have tried to use the JDBC Request to see if I could get a connection first but alas to no avail.

    in the configuration window I have the following:

    Driver: com.oracle.jdbc.Driver
    Connection String: jdbc:oracle:thin:@//someserver:1521/DB Name, "username", "password"

    SQL Query: SELECT COUNT(*) FROM LGNOM_INDIVIDUAL;

    but when tring to test I get back:

    com.eviware.soapui.support.SoapUIException: Failed to init connection for drvr [com.oracle.jdbc.Driver], connectionString [jdbc:oracle:thin:@//someserver:1521/B Name,, "username", "password"]

    Regards
  • Nessie's avatar
    Nessie
    Occasional Contributor
    Hi,

    Got a bit further, it looks like I had the connection string messed up, have tried to connect to two different servers and oracle refused a connection on one and the Network Adapter could not establish the connection on the other one.

    Getting closer now.

    Thanks for your help...