Connecting to MySQL database using workfusion custom script

I am trying to connect to MySQL database using groovy in workfusion custom script.
This is the one line typical Groovy code to connect to MySQL db (using eclipse)

import groovy.sql.Sql
** output = Sql.newInstance(“jdbc:mysql://localhost:3306/testdb”,“root”, “root”, “com.mysql.jdbc.Driver”)**
This requires a mysql-connector-java which can be easily added in eclipse.

But in case of Workfusion there is no place to add this jar so that we can connect to DB(May be I haven’t found it). Please someone help me on this. If any, please suggest other methods to connect to MySQL db.

Hi @YadavYadu

Please check this solution -
Also this topics may help you: How to connect to a Database (via Scripting)

I don’t have the access to the topic it seems for this

jdbc uses different classloader than groovy/beanshell. In order for it to properly work - the jar need to be added to the classpath before WorkFusion App or WorkFusion Studio start up.
WorkFusion App server comes with mysql driver pre-packaged (tomcat/lib/mysql-connector-java-5.1.15.jar), so on the WorkFusion server the code should work fine without adding extra jar.
In WorkFusion Studio - add the jar to the Eclipse classpath.

Also check out the out-of-the-box database plugin (
Code would look something like following:

    <database connection="jdbc:mysql://localhost:3306/sakila" jdbcclass="com.mysql.jdbc.Driver"
    		username="user" password="securepassword">

    		select first_name from actor

Here’s the message @YadavYadu