Forum Discussion

Usha_Kodali's avatar
Usha_Kodali
Frequent Contributor
16 years ago

JDBC Connections - groovy script

I created groovy scipt for Oracle db connection.
I call the script in Project LoadScript as

def racdb = new JDBCConnections(log)
def sql = racdb.Connections()
log.info(sql)

How do I access sql in the testcase,datasource file?
I tried creating property and setting it...but getting following error

groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlProjectPro.setPropertyValue() is applicable for argument types: (java.lang.String, groovy.sql.Sql) values: [sql, groovy.sql.Sql@1a9f3b4] Possible solutions: setPropertyValue(java.lang.String, java.lang.String), getPropertyValue(java.lang.String)

My method:

def JDBCConnections()
{
String racdb = Sql.newInstance("""jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=******) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=*****) (PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=******)))""",
"*****","*****",
"oracle.jdbc.driver.OracleDriver")
return racdb
}

The OracleThinDriver connection which is provided by SoapUI doesnt support the way I want.

6 Replies

  • Usha_Kodali's avatar
    Usha_Kodali
    Frequent Contributor
    Hi Ole,

    Can you provide me the connection string atleast which works for clustered database?
    I have more than 2 hosts and the SoapUI gives me only one host in the UI

    My connection string is like this:

    String racdb = Sql.newInstance("""jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
    (ADDRESS=(PROTOCOL=TCP)(HOST=******) (PORT=1521))
    (ADDRESS=(PROTOCOL=TCP)(HOST=*****) (PORT=1521))
    (CONNECT_DATA=(SERVICE_NAME=******)))""",
    "*****","*****",
    "oracle.jdbc.driver.OracleDriver")
  • Hi Usha,

    I'm sorry, I have no idea.. aren't there any examples in the oracle jdbc driver documentation?

    regards!

    /Ole
    eviware.com
  • Usha_Kodali's avatar
    Usha_Kodali
    Frequent Contributor
    Hi Ole,

    In SoapUI tutorials the connection string for Oracle is for single Host.
    I want to multiple hosts.

    If I call this function in groovy script it works.
    But how do I access sql accross the project and Datasource?

    def racdb = new JDBCConnections(log)
    def sql = racdb.Connections()
    log.info(sql)

    def JDBCConnections()
    {
    String racdb = Sql.newInstance("""jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
    (ADDRESS=(PROTOCOL=TCP)(HOST=******) (PORT=1521))
    (ADDRESS=(PROTOCOL=TCP)(HOST=*****) (PORT=1521))
    (CONNECT_DATA=(SERVICE_NAME=******)))""",
    "*****","*****",
    "oracle.jdbc.driver.OracleDriver")
    return racdb
    }
  • Usha_Kodali's avatar
    Usha_Kodali
    Frequent Contributor
    Hi Ole,
    I got the clustered database connection working successfully now

    Hope this string helps others who has Oracle DB which has Load Balance set on.
    In the JDBC Connections tab at the project level,

    Name: QA
    Driver: oracle.jdbc.driver.OracleDriver
    Connection String: jdbc:oracle:thin:username/password@(DESCRIPTION=(ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=HOST1)(port=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=HOST2)(port=1521))) (CONNECT_DATA=(server=dedicated) (SERVICE_NAME= SERVER_NAME)))
  • Hi Ole,

    We are currently using clsutered database (Oracel RAC) and was unable to configure database conection from SOAPUI JDBC connections.

    I have copied ojdbc6.jar under SOAPUI_HOMe/bin/ext and restarted the soapui, and selecting "Oracle thin/oracle.jdbc.driver.OracleDriver" from driver drop down and giving host, port, DB user, DB password and service name as ., but we don't have SID rather we have service name. but gettign error as "Can't get the Connection for specified properties; java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186646784)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))"

    Please let us know how to configure cluster database connections and what .jar files need to be copied under /bin/ext folder? my connection-url looks like as below:
    jdbc:oracle:thin:@(description=(address_list=(load_balance=on)(failover=on)(address=(protocol=tcp)(host=hostname)(port=1521)))(connect_data=(service_name=servicename)(failover_mode=(type=select)(method=basic))))

    We use JDK1.6 in my project.

    Thanks
    Raju