utPLSQL / utPLSQL-maven-plugin

Maven plugin for running Unit Tests with utPLSQL v3
Apache License 2.0
13 stars 11 forks source link

No suitable driver for ... - Oracle driver is not loaded #11

Closed jgarec closed 6 years ago

jgarec commented 6 years ago

Hi,

As discussed in #9, i need to explicitly load oracle driver class. If not, the plugin won't work : "no suitable driver for ..".

What do you think about creating a new optional parameter :

    @Parameter(defaultValue = "oracle.jdbc.OracleDriver")
    private String driverClass;

and then check / load the driver (class.forname will initialize the class (registering the driver in a static method)

// Load driver
Class.forName(driverClass); 

Is there any case where users have to use another driver class ?

Or we could use the same code used in the cli : https://github.com/utPLSQL/utPLSQL-cli/blob/develop/src/main/java/org/utplsql/cli/OracleLibraryChecker.java

pesse commented 6 years ago

Don't think there is any need for flexibility of driver class in maven-plugin. You wouldn't embed that into other solutions but instead use java-api. Therefore no need for more complexity.

alberto-hernandez commented 6 years ago

I can't reproduce the problem.

jgarec commented 6 years ago

Yeah that’s strange. It’s not necessary when i run the « unit test project ». But i need to add this line when using the plugin with a real project.

alberto-hernandez commented 6 years ago

The oracle driver is a transitive dependency from the api that use the maven-plugin, so this is very strange. Could you provide more information about your environment (JDK, SO)

jgarec commented 6 years ago

Can't reproduce anymore ....