Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DriverPath and LoadJDBCJars #89

Closed
npetzall opened this issue May 11, 2017 · 10 comments · Fixed by #297
Closed

DriverPath and LoadJDBCJars #89

npetzall opened this issue May 11, 2017 · 10 comments · Fixed by #297

Comments

@npetzall
Copy link
Member

npetzall commented May 11, 2017

-dp takes a string, it can be either a single lib or list of libs separated by File.pathSeparator.

There is an option -loadjars which will load sibling libs, however this only works when -dp is set to a single lib.

I would propose that driver path (-dp) can be used with:

  • Single library: just load that file
  • List of paths to libraries: load only these files/directories
  • Directory: load all libraries in that directory

and thus remove the -loadjars option from command-line

A tiny hack would be that -loadjars only operate on the first lib found in -dp

@aadrian
Copy link

aadrian commented May 11, 2017

@npetzall
Copy link
Member Author

I updated the issue and jcommander doesnt solve the issue. But that might be because I was unclear about the issue.

@rafalkasa
Copy link
Member

@npetzall -loadjars parameter was added to the SchemaSpy to resolve issue with Cloudera Impala JDBC driver. You cna read more here - Support for Impala #64

Now -loadjars is loading only additional drivers that are in the same folder where JDBC driver it is, nothing more nothing less.

Based on my understanding you would like to extend -dp functionality in a little different manner for other purposes to cover other JDBC cases similar to Cloudera Impala.

I will try to thnik about this change and maybe we can improve this a little

@rafalkasa rafalkasa self-assigned this May 13, 2017
@rafalkasa rafalkasa added this to the 6.0.0-rc2 milestone May 13, 2017
@npetzall
Copy link
Member Author

Impala wouldn't actually need a loadjars since the jars could have been specified.
Jar1:Jar2:Jar3 etc etc.

So having -loadjars which is incompatible with the above seems complex.

I'll have another look at it tonight.

@npetzall
Copy link
Member Author

npetzall commented May 14, 2017

-dp

Allows to specify driverjar and additional jars
format:
lib/one.jar
or
lib/one.jar:lib/two.jar:lib/three.jar

-loadjars

Allow to specify driverjar and it will load all jars in same folder (now it actually loads .?ar(jar,war,nar etc)
However it puts constraint on -dp path it can not be in de second form:
lib/one.jar:lib/two.jar,lib/three.jar

The proposed solution with a small twist.
-dp would allow specific jar, list of jars lib/one.jar:lib/two.jar:lib/three.jar:lib/anyOtherTypeOfFile
and even list of directories lib:ext-lib.

If -dp element is a directory it will include all .?ar file and even the directory to the classpath of driver loading.

So instead of listing jars or even a single jar and adding -loadjars true, it would load them.

Everything above would just be: -dp lib

@rafalkasa
Copy link
Member

@npetzall thank you for detailed explanation and description. I fully agree with you that it will be much easier for SchemaSpy users to have only one parameter -dp and few specyfic option how to load the driver or additional files related to it.

I would like to start working on this enhancement after when I will merge changes made by @Riggs333 to the Config class with new JCommander added to the project.

@npetzall
Copy link
Member Author

@rafalkasa this can be done right now, the change is local to DbDriverLoader. You can leave the -loadjars option and it can be removed after his PR. DbDriverLoader will just stop using loadjars flag.

@rafalkasa rafalkasa modified the milestones: 6.1.0, 6.0.0-rc2 Jun 20, 2017
@npetzall
Copy link
Member Author

npetzall commented Nov 7, 2017

@rafalkasa Ok if i grab this one?

@rafalkasa
Copy link
Member

Yes sure you can grab this one, I'm more than happy that you have energy and time to working on SchemaSpy

@npetzall npetzall assigned npetzall and unassigned rafalkasa Nov 7, 2017
@npetzall
Copy link
Member Author

npetzall commented Mar 8, 2018

I haven't verified order since it hasn't been an issue.
We need to talk about classloaders and not classpaths.

When the driver is loaded we create a new classloaders if -dp has resulted in existing path(s).
This classloaders uses the classloaders of schemaspy as it's parent classloaders so they are chained.

I did a quick look in Class.java and sadly it's a native call. But what I've heard about classloading is that it checks the parent first. Child first is normally found in applicationservers like tomcat to avoid static classes to be shared between applications.

So there is no requirement to use dp or that it needs to point at a file not on classpaths.

This fact is used in the docker image which doesn't use -dp but classpath.

So if order is truly important I can verify it.
Any change in order would require a use-case just so that we can implement it as a test, describing why we want that behavior.

@npetzall npetzall modified the milestones: 6.1.0, 6.0.0 Jun 12, 2018
@npetzall npetzall added this to To do in 6.0.0 Release via automation Jun 12, 2018
@npetzall npetzall moved this from To do to In progress in 6.0.0 Release Jun 12, 2018
6.0.0 Release automation moved this from In progress to Done Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
6.0.0 Release
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants