Forum Discussion

cbyndr's avatar
cbyndr
Contributor
15 years ago

[SO]oracle drivers not found for groovy script, despite adding jar to ext folder

I have written a groovy script to open a JDBC connection, execute some select statements, and parse the sql results for later test requests.

So, I added oracle jdbc jar - specifically, ojdbc14.jar - to the 'ext' directory.

And added the following to the groovy script:

import groovy.sql.Sql
sql = Sql.newInstance("jdbc:oracle:thin:applicationname/appinstance@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dev-xxx.app.net) (PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dev-xxx.app.net) (PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PPPAAA)))")

But, I get the following error message:

17:14:44,237 ERROR [SoapUI] An error occured [No suitable driver found for jdbc:oracle:thin:applicationname/appinstance@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dev-xxx.app.net) (PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = dev-xxx.app.net) (PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PPPAAA)))], see error log for details

If I have already added the correct jar to ext, what else to I need in the groovy script in order for its drivers to be available to the groovy script?

I am able to use this exact connection string with a Datasource Step. It's only with the groovy script that the drivers fail to be found.

1 Reply

  • Well, all I ended up needing to do is add this bit:

    def driver = oracle.jdbc.driver.OracleDriver

    Voila! Drivers found.