Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #33981

Re: Troubles with informix jdbc driver ...

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Troubles with informix jdbc driver ...
Date 2016-03-15 21:25 -0400
Organization Aioe.org NNTP Server
Message-ID <ncaclv$tgv$1@gioia.aioe.org> (permalink)
References <slrnnedgqn.456.avl@login.logic.tuwien.ac.at> <nc7d8t$oki$1@gioia.aioe.org> <slrnneh33t.456.avl@login.logic.tuwien.ac.at>

Show all headers | View raw


On 3/15/2016 6:25 PM, Andreas Leitgeb wrote:
> Arne Vajhøj <arne@vajhoej.dk> wrote:
>> On 3/14/2016 9:54 AM, Andreas Leitgeb wrote:
>>> A previous version of Informix jdbc ("3.70.JC5DE") was very
>>> strict with "thread safety", in that it governed any connection
>>> to any db server with a global lock.  If one DB server was
>>> temporarily unreachable, then it would block also connections
>>> to any other db server (attempted from other threads).
>>>
>>> Some newer version of their jdbc driver (4.10.JC5) seems to
>>> have that fixed, but we now observe that Connections obtained
>>> from calling DriverManager.getConnection(...) casually get
>>> mixed up!  As a result, we observe threads retrieving data
>>> from wrong servers - not always, but "moderately reproducible".
>>
>> I have never seen such a problem before.
>> But let us investigate a bit.
>> So essentially you have
>>
>> thread 1:
>> Connection cona = DriverManager.getConnection(constr2a);
>>
>> thread 2:
>> Connection conb = DriverManager.getConnection(constr2b);
>>
>> and sometimes you end up with the Connection object actually having
>> the connection to the wrong database (different connection string)?
>
> Yes, that's my interpretation of what's happening at the lower levels,
> based on observing the higher levels...  I'll first need to come up with
> an <sccee> to run on my PC, then I can add further debugging aids to
> determine if two threads eventually get references to the same connection,
> or whether they get two separate connections for the wrongly same db-url.

Unless you are using a faulty connection pool or Connection is
non-local then I don't see the first as being likely.

>> As if there somewhere deep down in the driver code were a static field
>> being overwritten.
>> That would be easy to test by just putting:
>> synchronized(DriverManagager.class) {
>> }
>> around all the getConnection calls.
>
> Like Marcel in his follow-up, I can't quite see how that could
> help me locate the bug.

It may help convince IBM that it indeed it is a bug in their
code.

>                             It would probably "fix" the bug, but
> get me back to what I had with the old driver, namely the problem
> that a single bad connect will - until timeout of the tcp-connect -
> block other threads from connecting even to other&alive servers.

True.

But if you have an unreliable connection between the application and
the database, then I think you should fix that. Because it would not
just impact connect but everything else as well. It will never work
well.

Arne

PS: Have you considered biting the bullet and switching to using a
     connection pool? It would probably fix all your problems!

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Troubles with informix jdbc driver ... Andreas Leitgeb <avl@logic.at> - 2016-03-14 13:54 +0000
  Re: Troubles with informix jdbc driver ... Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-03-14 21:23 +0100
    Re: Troubles with informix jdbc driver ... Andreas Leitgeb <avl@logic.at> - 2016-03-14 21:30 +0000
  Re: Troubles with informix jdbc driver ... Arne Vajhøj <arne@vajhoej.dk> - 2016-03-14 18:16 -0400
    Re: Troubles with informix jdbc driver ... Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-03-15 21:57 +0100
      Re: Troubles with informix jdbc driver ... Arne Vajhøj <arne@vajhoej.dk> - 2016-03-15 21:18 -0400
    Re: Troubles with informix jdbc driver ... Andreas Leitgeb <avl@logic.at> - 2016-03-15 22:25 +0000
      Re: Troubles with informix jdbc driver ... Arne Vajhøj <arne@vajhoej.dk> - 2016-03-15 21:25 -0400
  Re: Troubles with informix jdbc driver ... Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2016-03-14 21:26 -0700
    Re: Troubles with informix jdbc driver ... Andreas Leitgeb <avl@logic.at> - 2016-03-15 22:09 +0000
      Re: Troubles with informix jdbc driver ... Andreas Leitgeb <avl@logic.at> - 2016-03-16 21:37 +0000
        Re: Troubles with informix jdbc driver ... Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2016-03-16 22:36 -0700
          Re: Troubles with informix jdbc driver ... -- workaround found Andreas Leitgeb <avl@logic.at> - 2016-03-17 17:23 +0000
            Re: Troubles with informix jdbc driver ... -- workaround found Andreas Leitgeb <avl@logic.at> - 2016-03-18 11:13 +0000

csiph-web