Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #33977
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Troubles with informix jdbc driver ... |
| Date | 2016-03-15 22:09 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrnneh26c.456.avl@login.logic.tuwien.ac.at> (permalink) |
| References | <slrnnedgqn.456.avl@login.logic.tuwien.ac.at> <mcmurtrie-9B0C6C.21264114032016@news.sonic.net> |
Kevin McMurtrie <mcmurtrie@pixelmemory.us> wrote: > In article <slrnnedgqn.456.avl@login.logic.tuwien.ac.at>, > Andreas Leitgeb <avl@logic.at> wrote: >> 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". > 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. Thanks! I put this on my todo-list of things I'll experiment with. For now, a coworker will prepare a simple class that will connect to a selected db server (one of a few) and pick a row from some table that will allow us to check whether the row comes from the right server. Once I can reproduce the bug with simpler code than that pretty complex productive code, then I expect to either be able to cut it down to an <sccee>, or actually find a bug in my code. Either way ... ;-) > You must call Driver.connect(String, Properties) with a new Properties > instance each time. I definitely use a fresh Properties instance for each getConnection() at the moment. > Many drivers put parameters in there that can't be > shared between connections. This could be how you're seeing mixups. Yeah, reusing Properties instances would be pretty negligent. > If the Informix JDBC driver is still really terrible at multi-threading, Well, I can't prove that, yet. > 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 don't fully understand this. So far I asked the DriverManager for Connections. If I were to load the informix driver class explicitly, then would I keep one driver instance for the whole VM, or a "throw away" one for each new connection, or just a couple of driver objects to be used "round robin" just to create connections and given back afterwards? I could try such a driver-pool eventually (once I can reproduce the bug on my own PC). What I cannot do is switch to a *connection*-pool. My threads' db usage patterns are just not compatible with connection pooling, mostly because most of the threads have their private credentials for their connections and keep them occupied for extended periods of time. It wouldn't have occurred to me to suspect DriverManager (isn't that a class of the JRE, rather than of the specific driver?), so thanks for that heads-up.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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