Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 90261 invoked from network); 27 Aug 2009 11:56:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Aug 2009 11:56:46 -0000 Received: (qmail 7991 invoked by uid 500); 27 Aug 2009 11:56:44 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 7874 invoked by uid 500); 27 Aug 2009 11:56:44 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 7864 invoked by uid 99); 27 Aug 2009 11:56:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Aug 2009 11:56:44 +0000 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [130.132.232.16] (HELO arwen.med.yale.edu) (130.132.232.16) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Aug 2009 11:56:33 +0000 Received: from moussaka.med.yale.edu (moussaka.med.yale.edu [128.36.29.108]) by email.med.yale.edu (PMDF V6.2-X17 #31441) with ESMTPS id <0KP11WYMAAHKV5@email.med.yale.edu> for user@commons.apache.org; Thu, 27 Aug 2009 07:56:08 -0400 (EDT) Date: Thu, 27 Aug 2009 07:56:08 -0400 From: Mark Shifman Subject: Re: What's required to convert from DBUtils 1.1 to DBUtils 1.2? In-reply-to: <146DF7FF8585F646BE05D2BF63D4A8B2AE44FD@EM7.ad.ucla.edu> To: Commons Users List Message-id: <4A967458.50002@yale.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.21 (X11/20090302) X-Enigmail-Version: 0.95.6 References: <146DF7FF8585F646BE05D2BF63D4A8B2AE424E@EM7.ad.ucla.edu> <4A951F13.4010005@yale.edu> <146DF7FF8585F646BE05D2BF63D4A8B2AE44EF@EM7.ad.ucla.edu> <146DF7FF8585F646BE05D2BF63D4A8B2AE44F6@EM7.ad.ucla.edu> <146DF7FF8585F646BE05D2BF63D4A8B2AE44FD@EM7.ad.ucla.edu> X-Virus-Checked: Checked by ClamAV on apache.org The old Oracle driver failed in the same place. I think some databases don't take ParameterMetaData very seriously. I guess the only thing you could do is override fillStatement (or wait for a fixed Microsoft jdbc driver) but at some point enough is enough. You might just want to stick with 1.1 for now. mas Watkin, James wrote: > Here's a recent related post to a Microsoft website where Microsoft > seems to be admitting flaws in their JDBC driver. Although my queries > don't use table aliases, they still fail. > > http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=mi > crosoft.public.sqlserver.jdbcdriver&tid=95a47cdd-72ce-450b-9bca-3bee0203 > 8b17&cat=en_US_22326e25-7529-45bb-a7af-96ec8a2601d7&lang=en&cr=US&sloc=& > p=1 > > Has anyone gotten DBUtils 1.2 to work with the Microsoft JDBC driver? I > haven't used the jTDS driver in a long time, does jTDS work for this > issue? Does the most recent version of jTDS work well generally? > > Jim > > -----Original Message----- > From: Watkin, James [mailto:james.watkin@anderson.ucla.edu] > Sent: Wednesday, August 26, 2009 7:45 PM > To: Commons Users List > Subject: RE: What's required to convert from DBUtils 1.1 to DBUtils 1.2? > > Within DBUtils 1.2, these exceptions are being thrown from the call to > stmt.getParameterMetaData() within QueryRunner.fillStatement: > > public void fillStatement(PreparedStatement stmt, Object[] params) > throws SQLException { > > if (params == null) { > return; > } > > ParameterMetaData pmd = stmt.getParameterMetaData(); > ... > ... > > Some earlier SELECT queries without parameters are getting executed > without throwing any exceptions. > > DBUtils 1.1 doesn't seem to use the stmt.getParameterMetaData() call. > > This is failing with the latest Microsoft JDBC driver, version 2.0, > sqljdbc4.jar, with Java 1.6.0_11. I suppose I can try updating my JDK. > > Jim > > -----Original Message----- > From: Watkin, James [mailto:james.watkin@anderson.ucla.edu] > Sent: Wednesday, August 26, 2009 6:32 PM > To: Commons Users List > Subject: RE: What's required to convert from DBUtils 1.1 to DBUtils 1.2? > > Mark, > > Thank you for your reply. My app breaks with the following exception: > > java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: > Incorrect syntax near the keyword 'FROM'. Query: SELECT program FROM > programs WHERE (code = ?) Parameters: [MFE] > at > org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:540) > at > org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:397) > at > org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:352) > > I've tried replacing my MS SQL Driver with the latest download, but that > doesn't help. When I comment out the code throwing the error, I get an > error on the next query: > > Caused by: java.sql.SQLException: > com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near > ','. Query: SELECT a.serial FROM applicants_ext ae JOIN applicants a ON > ae.applicant_serial = a.serial WHERE (ae.applicant_ext_serial = ?) AND > (ae.app_type = ?) AND (a.year = ?) Parameters: [XXXXXXX, A, 2010] > at > org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:540) > at > org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:397) > at > org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:369) > > Jim > > -----Original Message----- > From: Mark Shifman [mailto:mark.shifman@yale.edu] > Sent: Wednesday, August 26, 2009 4:40 AM > To: Commons Users List > Subject: Re: What's required to convert from DBUtils 1.1 to DBUtils 1.2? > > Almost nothing is required to convert to 1.2. Read the release notes > and see if any of the changes affect you. > http://commons.apache.org/dbutils/changes-report.html > > I was burned by the way they changed CaseInsensitiveHashMap so I just > overrode it with the old one. I also had a problem because of > oracle (so what else is new) but when I upgraded to the newest driver > things worked fine. > > How does 1.2 break your app? > mas > > > Watkin, James wrote: >> I'm experiencing a well-known problem with DBUtils 1.1 where sometimes >> NULLs are converted to 0 when read from the database -- >> http://issues.apache.org/jira/browse/DBUTILS-42 >> >> >> >> I see that DBUtils 1.2 fixes this problem. However, DBUtils 1.2 breaks >> my app. Before I commit to "fixing" my app, can anyone outline the >> amount of work required to upgrade one's app for use with DBUtils 1.2? >> I'm using the MS SQL Server JDBC driver. >> >> >> >> Thank you. >> >> >> >> Jim >> >> >> >> >> >> > -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 mark.shifman@yale.edu --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org