-
Notifications
You must be signed in to change notification settings - Fork 820
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
Use waffle-jna 3.2.0 #2690
Comments
can someone from Datagrip chime in here ? |
DataGrip uses the following dependencies for PostgreSQL JDBC 42.5
So, there are two ways:
|
@tjlee , It looks like the key difference is that newer jna-platform require WDYT if we add a reflection-based check for SecBufferDesc vs SspiUtil.ManagedSecBufferDesc? |
First off, I'm sorry this comment is so long (and long-winded) again. I have recently been advised that
I respectfully disagree. pgjdbc just does not use the latest version of waffle-jna and therefore JNA. The most important issue right now is that the JetBrains side does not seem to fully understand the nature of the problem; at least I have not seen anything from there that would indicate otherwise. I have gone to great lengths to explain it and even provided instructions to reproduce the problem, but it looks like we keep talking past each other. In short, again, pgjdbc currently only works with JNA 4, but DataGrip 2022.3 forces it to use JNA 5(.12.0) because it also uses JNA 5(.12.1) internally. This issue first appeared in DataGrip 2022.3 after previous versions did not do this (or did not do it in the same way). That is, the current version of DataGrip intentionally behaves in a way that prevents SSPI auth in current pgjdbc from working. Note that I do not mean to claim that it is DataGrip's/JetBrains' intention to break pgjdbc, but that a behavior of DataGrip that was put in there for some specific purpose interferes with pgjdbc's proper operation. The best fix that I am currently aware of is the one I opened this bug over: Modify pgjdbc to be compatible with JNA 5 and depend on waffle-jna 3.2.0. I am concerned, however, that in doing this pgjdbc would pursue a global solution (affecting all users everywhere) to a local problem (incompatibility with a single vendor's IDEs). A superior solution would be to resolve the incompatibility on the IDE side and allow, as proposed above, "users to choose a proper library themselves" (or rather, let them choose to rely on the – already correctly declared – dependencies). The only ones who can state with certainty whether this is possible, i.e. if DataGrip can be configured or modified to allow two JNA versions (its own and pgjdbc's) to coexist, are JetBrains' developers. A mitigating factor to the global-solution-to-local-problem is that it may well be a good idea for pgjdbc to track the current version of JNA anyway, and perhaps even provide two distributions, one each for use with JNA 4 and JNA 5, as long as the necessary code change is as minimal as it appears to be. |
We may be able to do this with reflection and not have to provide 2 versions. Something which adds quite a bit of work on our end as we have a number of versions currently. |
That would mean removing the (optional) dependency on waffle-jna entirely, wouldn't it? Or is it possible to declare it without a version because by itself it has no effect anyway? I'm concerned about losing the "documentation" aspect of having it in the POM. Agreed on the reflection, of course. |
Yes, I guess it would. |
I'm no Maven expert, but from the description of optional dependencies on the Maven site
it seems to me that optional dependencies really have no effect on anything, they are purely informational. If that is true, pgjdbc could, instead of removing the one it has, include optional dependencies on both waffle-jna versions. |
Unless the different versions are at different coordinates (groupId or
artifactId different), only 1 version can be declared in the pom.
If we want to effectively support multiple major versions, we should
declare dependency on lower major version (in pom) and document/comment
support for higher version being present at runtime.
…On Sun, Dec 11, 2022 at 11:39 AM Christian Ullrich ***@***.***> wrote:
I'm no Maven expert, but from the description of optional dependencies on
the Maven site
If a user wants to use functionality related to an optional dependency,
they have to redeclare that optional dependency in their own project.
it seems to me that optional dependencies really have no effect on
anything, they are purely informational. If that is true, pgjdbc could,
instead of removing the one it has, include optional dependencies on
*both* waffle-jna versions.
—
Reply to this email directly, view it on GitHub
<#2690 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAW3U3LNQLMATGASAE43DRDWMYGUVANCNFSM6AAAAAASSLRZ4Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Inspired by bokken, pgjdbc#2690 (comment)
Our application is using JNA 5 and Postgres. We now have a requirement to have Windows Authentication in place but we cannot downgrade to an earlier version of JNA, and Postgres is only compatible with old versions of JNA/Waffle. |
Thanks for the heads-up. We will release 42.7.1, and we could probably integrate the fix as well |
…ManagedSecBufferDesc This commit makes pgjdbc code compatible with both jna-platform 4.5 and jna-platform 5.x The reason for the change is that SecBufferDesc was improperly typed in jna-platform 4.5, so they suggested completely drop the old constructor. Now we try both constructors, and use the newer one. Inspired by bokken, pgjdbc#2690 (comment) Fixes pgjdbc#2690
…ManagedSecBufferDesc (#2720) This commit makes pgjdbc code compatible with both jna-platform 4.5 and jna-platform 5.x The reason for the change is that SecBufferDesc was improperly typed in jna-platform 4.5, so they suggested completely drop the old constructor. Now we try both constructors, and use the newer one. Inspired by bokken, #2690 (comment) Fixes #2690
…ManagedSecBufferDesc (pgjdbc#2720) This commit makes pgjdbc code compatible with both jna-platform 4.5 and jna-platform 5.x The reason for the change is that SecBufferDesc was improperly typed in jna-platform 4.5, so they suggested completely drop the old constructor. Now we try both constructors, and use the newer one. Inspired by bokken, pgjdbc#2690 (comment) Fixes pgjdbc#2690
I'm submitting a ...
Describe the issue
As previously discussed in #2668, there is a compatibility problem when using pgjdbc in JetBrains DataGrip with SSPI authentication (i.e. from a Windows client to a database server offering either SSPI or GSS-API authentication).
(For DataGrip, read "every one of the dozen or so members of JetBrains' IDE family"; they are all IDEA with slightly different default features.)
The immediate problem was fixed on 30 November when JetBrains changed the configuration of their IDE to no longer force the incompatible JNA 5.12.0 into pgjdbc's class path. On 1 December they then released the latest version of DataGrip, 2022.3, which is far more thoroughly incompatible because it uses JNA internally and cannot load the older version of JNA that waffle-jna 1.9.1 brings in.
I would like to request that pgjdbc move its waffle-jna dependency from version 1.9.1 to 3.2.0. This version uses JNA 5.12.1, the same version that DataGrip includes. This resolves the new compatibility issue.
I am aware that pgjdbc is not responsible for catering to choices made by a third party, however, if would really make my day :-).
The changes required to get a successful connection appear to be minimal (see https://github.com/chrullrich/pgjdbc/tree/waffle-jna-3.2.0). The only code change I had to make was using JNA's
SspiUtil.ManagedSecBufferDesc
class (added in JNA 5.0.0) instead ofSspi.SecBufferDesc
. However, I cannot make any promises about the reliability of the result; all I know is that the connection works and I can load data into the IDE from my particular database. I will of course be happy to assist with any testing necessary if you can tell me what to do.Driver Version?
42.5.2
Java Version?
11
PostgreSQL Version?
15.1
The text was updated successfully, but these errors were encountered: