连接数据库时出错[SOAP UI]

时间:2016-11-07 20:33:28

标签: soapui

我已将mariadb驱动程序放在SOAPUI_HOME / bin / ext目录中。它说没有这样的属性:sql for class

这是我尝试过的代码:

//Below is just a sample
//Change values as needed in below connection
def driver = 'org.mariadb.jdbc.Driver'
def connectionString = 'jdbc:mariadb://localhost:3306/db'
def user = 'your_user'
def password = 'secret'
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver(driver)
def sql = Sql.newInstance(connectionString, user, password, driver)
def query = 'select * from company'
sql.execute(query)

1 个答案:

答案 0 :(得分:1)

您缺少Sql类的import语句,在脚本顶部添加以下导入:

import groovy.sql.Sql