Groovy script for database manipulation using project property
I want to execute simple delete query with the schema nametaken from project properties, but I am not sure how to pass the value to it, current way doesn't work for me. import groovy.sql.Sql import com.eviware.soapui.support.GroovyUtils.* def dbURL = context.expand('${#Project#MSSQLUrl}') def dbUser = context.expand('${#Project#MSSQLUser}') def dbPass = context.expand('${#Project#MSSQLPassword}') def dbDriver = context.expand('${#Project#MSSQLDriver}') def dbschema1 = context.expand('${#Project#Schema1}') def dbschema2 = context.expand('${#Project#Schema2}') com.eviware.soapui.support.GroovyUtils.registerJdbcDriver(dbDriver) log.info (dbschema1) //logsEMP_SCHEMA def sql = Sql.newInstance(dbURL, dbUser, dbPass, dbDriver) sql.execute("DELETE FROM ['$dbschema1'].[dbo].[JOB] WHERE EMPNAME = 'NAME1'"); //doesnt work,com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name ''EMP_SCHEMA'.dbo.JOB'. error at line: 14 sql.execute("DELETE FROM [EMP_SCHEMA].[dbo].[JOB] WHERE EMPNAME = 'NAME1'"); //works Dont know how to pass the schema value to SQL querySolved3.8KViews0likes9CommentsDatabase testing using soap ui/ready api ?
My REST web service populate db records as output. I can connect to db server using jdbc from soap ui. How can I compare data populated in REST request and JDBC request ? Below are few points to consider: 1. The column names in REST request and JDBC request are different but data is same. 2. The order of the records also differs. So how can I compare data output of REST service and JDBC request ? Is there any way I modify the output order in both REST service and JDBC request ?so that I canmake them to display in same order and compare the data. Also looking to automate the process for multiple requests. Please guide me with a right solution Hope I clearly explained the challenge. Looking for a right solution. Thanks, Ravi3.5KViews0likes7CommentsCassandra Connection with Groovy Script In SoapUI
Dear Community, thanks for the time. I am trying to access a remote Cassandra DB in order to complete my assertions. I see that the Server is running: Cassandra V 3.0.8.1293 Driver Type: Cassandra CQL Datastax Java Driver for Apache Cassandra - Core [3.0.5] So, I am trying with the following code to access the DB import com.datastax.driver.core.* Cluster cluster = null; try { cluster = Cluster.builder().addContactPoint("x.x.x.x").withCredentials("xxxxxxx", "xxxxxx").withPort(9042).build() Session session = cluster.connect(); ResultSet rs = session.execute("select * from TABLE"); Row row = rs.one(); } finally { if (cluster != null) cluster.close(); } when I use the cassandra-driver-core-2.0.1.jar I am getting the error : ERROR:com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /x.x.x.x(null)) Read the documentation and a lot of posts here and on other blogs and I saw that there may be an incompatibility with the driver version so I tried to upgrade the driver to many versions (cassandra-driver-core-2.5,cassandra-driver-core-3,cassandra-driver-core-3.2), but on that I am getting the following: ERROR:java.lang.ExceptionInInitializerError Have also tried to connect using JDBC, but to no avail. using the configuration proposed at this thread https://community.smartbear.com/t5/SoapUI-NG/Apache-Cassandra-CQL-jdbc-connection/td-p/40050 Actually I am running out of ideas. Can anyone propose or point to some direction on how to actually achieve this, either by pointing me to some tutorial or any idea. Thank you very much3.3KViews0likes4CommentsInserting 10000 rows of data in database
Hi all, Goal: Use groovy to insert several rows in the database. Here I have to insert 10000 zipcodes with validity true or false in oracle database. Achieved: Know to insert one row Following is the code import groovy.sql.Sql import java.sql.SQLException import com.eviware.soapui.support.GroovyUtils.* try { def dbURL = context.expand('${#Project#ORACLE12c}') def dbUser = context.expand('${#Project#SchemaUser}') def dbPass = context.expand('${#Project#Pass}') def dbDriver = context.expand('${#Project#ORACLEDriver}') def dbconf = context.expand('${#Project#SchemaConf}') com.eviware.soapui.support.GroovyUtils.registerJdbcDriver(dbDriver) def sql = Sql.newInstance(dbURL, dbUser, dbPass, dbDriver) sql.execute("DELETE FROM "+dbconf+".ZipCodes WHERE VALID='true'") sql.execute("INSERT INTO "+dbconf+".ZipCodes (ZIPCODE, VALID) VALUES ('71232', 'true')"); } catch (SQLException e){ def tmp = e.getSQLState () log.error (tmp, e) } How to insert several rows using groovy teststep or even JDBC teststep? Pls ignore the syntax error, if any.Solved2.7KViews0likes3CommentsHow can i connect oracle SQL developer connection without entering "sid".
Please find the attached screenshot as well for reference. The problem i am facing is ..while connecting Oracle sqldeveloper I am entering service name and keeping the 'SID' field blank(which is not mandatory field in the tool). But in ReadyAPI(Please find the attached screenshot) sid is a mandatory field, i can not keep it blank while connecting. Hence i am getting error "Can't get the Connection for specified properties; java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection"2.7KViews0likes2CommentsCannot Connect to Oracle RDB Database
I'm trying to connect to an Oracle RDB Database which is not one of the listed databases. I have the driver for it and put it in the bin/ext folder. After trying to fill out the information in JDBC Drivers PropertiesI tried a number of ways to connect to it but with no luck. I'm looking for guidance as this is the first time I've tried to connect to a database type that wasn't listed as one of the defaults. Is there a specific way I need to enter the Driver name on the JDBC Drivers Properties page? I tried just using the name, the file name, the exact file path, but none worked. Currently this is the error I'm getting no matter what I try. Any help would be appreciated.Solved2.6KViews0likes3Comments