Ask a Question

how to load driver jar file to connect to database

Mr_Bro
Frequent Contributor

how to load driver jar file to connect to database

Hello All,

 

request you to please suggest how to load an external driver .jar to connectc to database, as i have have required access to add any files or modify any existing files from the c:\ drive (were the SoapUI is installed)

 

thanks in advance 

3 REPLIES 3
Shashavali
Contributor

try this

 

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def classpathHacker = new com.eviware.soapui.support.ClasspathHacker ()

log.info "utils=" + groovyUtils
path = groovyUtils.getProjectPath()
myfile = new java.io.File(path + "/ojdbc14.jar")
mystring = "file://" + path + "/ojdbc14.jar"
log.info "myfile=" + myfile

classpathHacker.addFile( myfile )
com.eviware.soapui.support.ClasspathHacker.addFile( myfile )
com.eviware.soapui.support.ClasspathHacker.addURL( new URL(mystring) )

import groovy.sql.*
def sql = groovy.sql.Sql.newInstance( db, userid, password, 'oracle.jdbc.driver.OracleDriver' )

 

https://community.smartbear.com/t5/SoapUI-Open-Source-Questions/Soapui-is-not-loading-external-jar-f... 

Mr_Bro
Frequent Contributor

@Shashavali ,

i have tried this approach and im encountring the below error ,

 

java.io.IOException: Error, could not add URL to classloader jdk.internal.loader.ClassLoaders$PlatformClassLoader error

@Mr_Bro 

 

https://community.smartbear.com/t5/SoapUI-Open-Source-Questions/Upgraded-to-SoapUI-5-6-0-unable-to-l...

 

looks like issue with the java version. 

 

don't you have access SmartBear\SoapUI-5.6.0\bin\ext folder ?

cancel
Showing results for 
Search instead for 
Did you mean: