Forum Discussion
ragirn
15 years agoNew Contributor
Hi All,
I got the solution for the problem I reported Above:)
The problem can be solved by copying files ocijdbc10.dll and oci.dll to the %SOAPUI_HOME%/bin directory from %ORACLE_HOME%/BIN directory. Now I can connect to my remote oracle database with TNSNames_Entry.
Both the Groovy script and JDBC test step work now.
For JDBC teststep you can use below syntax:
Driver: oracle.jdbc.driver.OracleDriver
Connection String: jdbc:oracle:oci:USERNAME/MYSECRETPASSWORD@MYSID
below is sample Groovy code to connect to database.
Any one facing similar issue please feel free to contact me / reply to this topic, I will be more than happy to help
I got the solution for the problem I reported Above:)
The problem can be solved by copying files ocijdbc10.dll and oci.dll to the %SOAPUI_HOME%/bin directory from %ORACLE_HOME%/BIN directory. Now I can connect to my remote oracle database with TNSNames_Entry.
Both the Groovy script and JDBC test step work now.
For JDBC teststep you can use below syntax:
Driver: oracle.jdbc.driver.OracleDriver
Connection String: jdbc:oracle:oci:USERNAME/MYSECRETPASSWORD@MYSID
below is sample Groovy code to connect to database.
//In a DB connect Script
import groovy.sql.Sql
import com.eviware.soapui.support.GroovyUtils.*
//try to create connection to database
//if not, log error
//In order for this to work, you need to have jdbc driver jar file in $SOAPUI_HOME/bin/ext folder
try {
log.info "trying to connect to DB here";
log.info System.properties['java.library.path']
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver("oracle.jdbc.driver.OracleDriver")
Sql sql = Sql.newInstance("jdbc:oracle:oci:@MYSID","USERNAME", "MYSECRETPASSWORD", "oracle.jdbc.OracleDriver")
sql.eachRow("select sys_context('userenv','db_name') from dual"){ row ->
log.info row.getString(1) //prints the SID of database info window
}
log.info "Handled Database";
} catch (Exception e) {
log.error "Could not establish connection to the database."
log.error e;
}
Any one facing similar issue please feel free to contact me / reply to this topic, I will be more than happy to help