Forum Discussion

knack's avatar
knack
New Contributor
7 years ago
Solved

Issue with mysql driver in groovy script

A problem with mysql driver in Groovy Script:

1. Add Groovy Script as step to Test case

2. Add definition for mysql driver, for example (the driver has been put before into bin\ext and the tool is restarted after that):

import groovy.sql.Sql

def testProject = context.testCase.testSuite.project

def user = testProject.getPropertyValue('user')
def password = testProject.getPropertyValue('password')
def props = [user: user, password: password, allowMultiQueries: 'true']
def url = testProject.getPropertyValue('url')
def driver = 'com.mysql.jdbc.Driver'

def sql = Sql.newInstance(url, user, password, driver)

3. Run the script - works fine.

4. Restart the tool

5. Run the script again - java.sql.SQLException: No suitable driver found for

 

But if run JDBC request with the driver from same test case and run the groovy script again - working again.