Skip to content

Load mssql jdbc driver with safety checks#6

Merged
rdubya merged 3 commits intojruby:5-2-stable-jdbcfrom
iaddict:patch-1
Dec 11, 2020
Merged

Load mssql jdbc driver with safety checks#6
rdubya merged 3 commits intojruby:5-2-stable-jdbcfrom
iaddict:patch-1

Conversation

@iaddict
Copy link

@iaddict iaddict commented Dec 9, 2020

First check if a jdbc driver is already loaded and then check if driver major version is sufficient.
Otherwise require "jdbc/mssql". Also see #4.

First check if a jdbc driver is already loaded and then check if driver major version is sufficient.
Otherwise require "jdbc/mssql".
Copy link
Collaborator

@rdubya rdubya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call on going this route. I like this approach.

which = driver
.getClass().getClassLoader().loadClass(driver_name)
.getProtectionDomain().getCodeSource().getLocation().to_s
warn "You alreday required a mssql jdbc driver (#{which}), skipping gem jdbc-mssql"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type here: "already"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Typo has been fixed.

@rdubya rdubya merged commit 63e8a46 into jruby:5-2-stable-jdbc Dec 11, 2020
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

Successfully merging this pull request may close these issues.

2 participants