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

Jar file contains MySQL #29

Open
jpaulm opened this issue Oct 8, 2020 · 2 comments
Open

Jar file contains MySQL #29

jpaulm opened this issue Oct 8, 2020 · 2 comments

Comments

@jpaulm
Copy link
Owner

jpaulm commented Oct 8, 2020

The jar file contains MySQL because of ReadJDBC and WriteJDBC - we need to find a way to defer this, probably using ClassLoader

@jpaulm
Copy link
Owner Author

jpaulm commented Oct 19, 2020

Looking at the jar file for javafbp, I see about 11 Mb of MySQL and ProtoBuf, combined - JavaFBP itself is about 0.5 Mb. Needless to say, I'd like to carve off the MySQL, etc., stuff.

I think there are a couple of ways, just blue-skying for now:

  • carve through the component method in the network definitions. However, this would mean intercepting every API call, and adding a level of indirection...

  • (better) separate mysql jar file from FBP-related logic and use Java reflection in MySQL-related components

  • (just added) imbed ReadJDBC and WriteJDBC in dynamic subnets (SubNet will need some tweaks)

Will keep you posted... input would be appreciated, of course!

@jpaulm
Copy link
Owner Author

jpaulm commented Oct 19, 2020

I now have a working version of ReadJDBC which uses reflection and names the MySQL jar file (in user\.m2\repository) - partial:

    File f = new File("C:\\Users\\" + userName + "\\.m2\\repository\\mysql\\mysql-connector-java\\8.0.21\\mysql-connector-java-8.0.21.jar");		
URL[] urls = {f.toURI().toURL()};
URLClassLoader ucl = new URLClassLoader(urls);
Class<?> conn_cls = ucl.loadClass("java.sql.Connection"); 
     ....    

The problems are: a) version number is hard-wired, and b) it is Eclipse-dependent (the MySQL jar file may be in different places

Ideally, I'd like to get it from Maven, but I'm not sure how to download the file, and then do a new File() on it!

Don't know how many people are watching this... but help would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant