Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3A93FFEDF for ; Tue, 6 Aug 2013 11:58:31 +0000 (UTC) Received: (qmail 99692 invoked by uid 500); 6 Aug 2013 11:58:27 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 99623 invoked by uid 500); 6 Aug 2013 11:58:26 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 99612 invoked by uid 99); 6 Aug 2013 11:58:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Aug 2013 11:58:25 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [207.211.31.74] (HELO service89-us.mimecast.com) (207.211.31.74) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Aug 2013 11:58:20 +0000 Received: from loftexchange.loftwareinc.com (WPIS-64-140-236-129.worldpath.net [64.140.236.129]) (Using TLS) by service89-us.mimecast.com; Tue, 06 Aug 2013 07:57:58 -0400 Received: from loftexchange.loftwareinc.com ([172.16.40.3]) by loftexchange.loftwareinc.com ([172.16.40.3]) with mapi; Tue, 6 Aug 2013 07:57:56 -0400 From: To: Date: Tue, 6 Aug 2013 07:57:55 -0400 Subject: RE: Auto-loading of the SQL Server JDBC Driver in 6.0.35 Thread-Topic: Auto-loading of the SQL Server JDBC Driver in 6.0.35 Thread-Index: Ac6R07Fg6a6ps7RkTp6XW8sFj14nfgAx8ISg Message-ID: References: <51FC082B.7000407@gmx.net> <51FC2472.1010704@yahoo.com> <7BF5C878-1E3A-4293-B6AF-881FB8F80C7D@gopivotal.com> In-Reply-To: <7BF5C878-1E3A-4293-B6AF-881FB8F80C7D@gopivotal.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-MC-Unique: 113080607575801401 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org > From: Daniel Mikusa [mailto:dmikusa@gopivotal.com] > Sent: Monday, August 05, 2013 7:56 AM > To: Tomcat Users List > Subject: Re: Auto-loading of the SQL Server JDBC Driver in 6.0.35 >=20 > On Aug 4, 2013, at 2:14 PM, MWick@loftware.com wrote: >=20 > >> From: Mark Eggers [mailto:its_toasted@yahoo.com] > >> Sent: Friday, August 02, 2013 5:28 PM > >> To: Tomcat Users List > >> Subject: Re: Auto-loading of the SQL Server JDBC Driver in 6.0.35 > >> > >> On 8/2/2013 1:30 PM, MWick@loftware.com wrote: > >>>> From: Michael-O [mailto:1983-01-06@gmx.net] Sent: Friday, August > >>>> 02, > >>>> 2013 3:28 PM To: Tomcat Users List Subject: Re: Auto-loading of the > >>>> SQL Server JDBC Driver in 6.0.35 > >>>> > >>>> Am 2013-08-02 21:24, schrieb MWick@loftware.com: > >>>>> I expect that by putting the SQL Server JDBC4 driver jar > >>>>> (sqljdbc4.jar) into ${CATALINA_HOME}/lib, that the driver would be > >>>>> automatically available upon server start. As expected, this > >>>>> works in 6.0.33, but fails in 6.0.35. It seems that the fix to > >>>>> Bug 51640 is the cause of this, and in fact, setting > >>>>> driverManagerProtection to false in the > >>>>> JreMemoryLeakPreventionListener allows this to work in 6.0.35 as > >>>>> well. I would not have expected that a change to the MemoryLeak > >>>>> Listener would have changed the behavior of the JDBC driver. > >>>>> > >>>>> I don't know the internals of the SQL Server driver, so I don't > >>>>> know exactly why this is happening. The MySQL driver loads > >>>>> without any issue. > >>>> > >>>> Why should the driver being loaded into memory if no one uses it? > >>>> Actually, a driver is loaded into the container's classloader cache > >>>> upon first access. This is what happens at least for me with the > >>>> Oracle driver. > >>>> > >>>> Everything else does not make sense to me. > >>>> > >>>> Michael > >>> > >>> Sorry, I wasn't clear. It's not loading the driver into memory, but > >>> rather registering it with the DriverManager that has changed, so > >>> that it can be loaded on the first request. This is no longer occurr= ing. > >>> > >>> Mark > >> > >> How are you accessing the driver? > >> > >> Are you using JDBC directly, or are you creating a JNDI pooled > >> connection and letting Tomcat manage it. > >> > >> . . . . just my two questions > >> /mde/ > > > > Using the Apache JDBC pool with DataSources, but directly. >=20 > Are you specifying a "driverClassName"? If you specify that and the JDBC > driver is available on the class path then the pool should just work. No= need > to call DriverManager or load classes. The pool should handle that for y= ou. >=20 > See example for using the pool from Java. >=20 > http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Plain_Ol'_Java >=20 > Dan > No. And there is no need. Type 4 JDBC drivers are supposed to register a= utomatically. I have created a simple test; copying the Oracle, SQL*Server= and MySQL drivers into ${CATALINA_HOME}/lib; starting Tomcat and then runn= ing a method that prints out the registered drivers (from DriverManager.get= Drivers()). With the default line below in server.xml, only the JdbcOdbc = bridge driver is registered. Driver Class sun.jdbc.odbc.JdbcOdbcDriver However, if I disable "driver manager protection" - effectively turn off th= e fix for 51640, as shown below, the JdbcOdbc bridge AND the 3 other driver= s are all listed as registered. I will file a bug. Driver Class sun.jdbc.odbc.JdbcOdbcDriver=20 com.mysql.jdbc.Driver=20 oracle.jdbc.OracleDriver=20 com.microsoft.sqlserver.jdbc.SQLServerDriver --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org