Hello everyone,
I embedded groovy into my application, and I want to access an Oracle
database through my groovy script.
The problem is that I am getting a "java.lang.ClassNotFoundException:
oracle.jdbc.driver.OracleDriver" error from my groovy script - but I'm
not sure why.
Any idea how i can get this to work or some instructions that points
to how i can accomplish this?
This is what I did:
1) from my GroovyClassLoader I added the ojdbc6.jar to my classpath
ie. groovyClassLoader.addClasspath(pathToOjdbc6.jar);
2) in my groovy script: I imported the oracle.jdbc.driver package ie.
import oracle.jdbc.driver.*
3) in my groovy script: created an OracleDriver class ie.
oracle.jdbc.driver.OracleDriver myOracleDriver = new
oracle.jdbc.driver.OracleDriver();
this was to check whether I have access to the classes in ojdbc6.jar.
(it did indeed work correctly)
4. in my groovy script: i try to execute the following code:
def db = Sql.newInstance
( myURL,myUser,myPassword,"oracle.jdbc.driver.OracleDriver");
then i get a "java.lang.ClassNotFoundException:
oracle.jdbc.driver.OracleDriver" thrown.
Any ideas?
Help is very much appreciated. I have been stuck on this issue for a
while.
Note that I am using groovy embedded in my application (running it
using "regular" nonembedded groovy ie. groovyConsole seems to work
ok).