I wrote a jenkins pipeline with groovy that connects with the mysql database. But when it connects to mysql it shows"
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
". Is there is any way to resolve this error. If not how can I connect do mysql operations with jenkins pipeline. I wrote a below code to connect with mysql database.
def props = [user: '', password: '', allowMultiQueries: 'true'] as Properties
def url = 'jdbc:mysql://myserver:port/'
def driver = 'com.mysql.jdbc.Driver'
def sql = Sql.newInstance(url, props, driver)
echo 'Database connection sucess'
Thanks,