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


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

Re: Troubles with informix jdbc driver ...

From Kevin McMurtrie <mcmurtrie@pixelmemory.us>
Newsgroups comp.lang.java.programmer
Subject Re: Troubles with informix jdbc driver ...
References <slrnnedgqn.456.avl@login.logic.tuwien.ac.at>
Date 2016-03-14 21:26 -0700
Message-ID <mcmurtrie-9B0C6C.21264114032016@news.sonic.net> (permalink)
Organization Sonic.Net

Show all headers | View raw


In article <slrnnedgqn.456.avl@login.logic.tuwien.ac.at>,
 Andreas Leitgeb <avl@logic.at> 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".
> 
> In my application the threads share little to no data, and there
> are definitely no static fields involved in my code related to 
> the keeping of jdbc-related objects.  I can't vouch for the
> driver, though.
> 
> Has anyone else observed similar effects with Informix jdbc drivers
> and a bunch of independent threads opening connections to different
> db servers?

There's too much legacy cruft and unreliable magic in DriverManager.  I 
strongly recommend finding your driver using Class.forName(classname), 
creating an instance, then calling it directly through its 
java.sql.Driver interface.

You must call Driver.connect(String, Properties) with a new Properties 
instance each time.  Many drivers put parameters in there that can't be 
shared between connections.  This could be how you're seeing mixups.

If the Informix JDBC driver is still really terrible at multi-threading, 
you can use your class reference to create a pool of instances of the 
driver.  I'd really hope that this is no longer necessary, but it had to 
be done with their driver a decade ago.

-- 
I will not see posts from astraweb, theremailer, dizum, or google
because they host Usenet flooders.

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