Forum Discussion

mohantysuchi's avatar
mohantysuchi
Occasional Contributor
7 years ago

getting class not found exception for oracle jdbc driver in groovy script

I am using groovy scripting in soap ui 5.3.0 to connect oracle DB and  getting the below error while running the script?

 

java.lang.classNotFoundException:oracle.jdbc.driver.OracleDriver

 

import groovy.sql.*
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver("net.sourceforge.jtds.jdbc.Driver")
def connstr = context.expand('${#Project#groovy_connstr}')
def dbuser = context.expand('${#Project#db_user}')
def dbpassword = context.expand('${#Project#db_password}')
def oracledriver = context.expand('${#Project#OracleDriver}')

def sql = Sql.newInstance(connstr, dbuser, dbpassword, oracledriver)
log.info "DB connection ready

 

I have placed ojdbc14 and ojdbc6-11.2.0.3 in soap ui/bin/ext folder. can anyone help me this?

 

  • New2API's avatar
    New2API
    Frequent Contributor

    Hi Mohantysuchi, try to drop ojbc6 jar in soapui/lib folder as well. 

     

    for connection string I am using below convention - 

     

    jdbc:oracle:thin:@ServerName:Port/TnsName
    
     
    
    //## Establish ORACLE connection ##//
    def ConnStr = Sql.newInstance(Server, ua, pw, "oracle.jdbc.driver.OracleDriver")

     

    hope this solution works!