A couple months ago I wrote about problems I was having with Tomcat and SQL Server where I would get Connection reset by peer
errors if the SQL Server was restarted. A couple people commented that instead of using the Microsoft provided JDBC SQL Server drivers, they had switched the open source jTDS driver available on sourceforge. I ignored them and went on my merry way, until yesterday when I ran into this really strange problem. I had a query written using Hibernate/HQL that would take approximately 10 seconds to run but the same query run in Query Analyzer would take less than 1 second. My code looked like this:
Query q = null;
Session session = HibernateFactory.currentSession();
String query = "select this and that from sometable";
q = session.createQuery(query);
List list = q.list();
for (int i = 0; i
Pretty simple, nothing out of the ordinary, it just took 10 seconds to go from the q.list()
to the for {}
block. I tried a bunch of different things: I modified the query, I tried using an Iterator rather than a List, I added named binding to the query. Nothing worked. Today I switched to the jTDS driver. Problem solved. I'll never use the Microsoft JDBC drivers again.
Thank god for that! 🙂
We have been using the inetd drivers for 4 years now, and they are the best (well worth the $250). Our app runs on resin with Hibernate and straight SQL. All works good, not a single problem.
http://www.inetsoftware.de/
Did you contact Microsoft support? It would have been interesting if you would have then trying to debug.
SQL Server DBA might not look favorably on having 3rd party uncertified drivers connecting to their server.
hi Gabriel,
> Did you contact Microsoft support? It would have been interesting if you would have then trying to debug.
— You’re kidding right? Calling Product Support Services costs $195 PER CALL. Why would I do that?
> SQL Server DBA might not look favorably on having 3rd party uncertified drivers connecting to their server.
— I’m pretty sure there that the DBA can’t find out what drivers I’m using, how would they find out besides looking my code?
AJ
I’m a jTDS developer so one might say I’m biased.
However, I would like to point out that Microsoft fixed around 20 or 30 minor bugs in 3 service packs for their JDBC driver, although they have a huge number of complaints (as a comparison, around 80 something jTDS bugs were fixed in just one month, before the last release). You might think that jTDS has more problems but the MS driver doesn’t even pass the JDBC compliance test suite.
The reason for the huge difference in performance is that the Microsoft driver has to use cursors for each SELECT (meaning one request/response for each row retriever) in order to support transactions.
Alin.
Sorry this is off subject but I didn’t know where else to put it. I was just looking at your tour of Fenway pictures (I read your site often) and noticed we must share a love for the BoSox! Isn’t this amazing that not only did they beat the Evil Empire but that they did it down 0-3 (first baseball team ever). I’m a huge baseball guy, planning on working in it next year. Im originally from California as well (the OC) and at West Virginia University Grad Program in Sport Management right now. I noticed a picture that you took…
http://cephas.net/photos/2004/fenway_park_photo_tour/index10.html
is similar to mine
http://www.the-coffeys.com/photoblog/2004/grad_trip/slides/031.html
for the whole album visit:
http://www.the-coffeys.com/photoblog/2004/grad_trip/index.html