From issues-return-68825-archive-asf-public=cust-asf.ponee.io@commons.apache.org Thu Jul 26 04:53:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 820E218062C for ; Thu, 26 Jul 2018 04:53:03 +0200 (CEST) Received: (qmail 32421 invoked by uid 500); 26 Jul 2018 02:53:02 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 32410 invoked by uid 99); 26 Jul 2018 02:53:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jul 2018 02:53:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 1003C180582 for ; Thu, 26 Jul 2018 02:53:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id KyRRrTZPsTph for ; Thu, 26 Jul 2018 02:53:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D41685F1C7 for ; Thu, 26 Jul 2018 02:53:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4DBFAE0178 for ; Thu, 26 Jul 2018 02:53:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1307D27752 for ; Thu, 26 Jul 2018 02:53:00 +0000 (UTC) Date: Thu, 26 Jul 2018 02:53:00 +0000 (UTC) From: "Bernd Eckenfels (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DBCP-461) Prepared statements are not cached with XA MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DBCP-461?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D165568= 16#comment-16556816 ]=20 Bernd Eckenfels commented on DBCP-461: -------------------------------------- Are you sure you reported this in the right project? Seems to me like a pro= blem in the interceptor from the Tomcat project. The DBCP uses `poolPrepare= dStatements=3Dtrue` instead. > Prepared statements are not cached with XA > ------------------------------------------ > > Key: DBCP-461 > URL: https://issues.apache.org/jira/browse/DBCP-461 > Project: Commons DBCP > Issue Type: Bug > Affects Versions: 1.4 > Environment: TomEE Version : Apache Tomcat Version 7.0.63 > Reporter: Sailaja > Priority: Major > > Prepared statements are not getting cached when I use XA datasource.=20 > Please find the below program : > {code:java} > =C2=A0=C2=A0=C2=A0 public static void main(String[] args) throws Exceptio= n { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 final TransactionManager trans= actionManager =3D TransactionManagerFactory.getTransactionManager(); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 final PoolProperties poolPrope= rties =3D new PoolProperties(); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SQLServerDataSource dataSource= =3D new com.microsoft.sqlserver.jdbc.SQLServerDataSource(); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dataSource.setUser("sa"); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dataSource.setPassword("$9Lser= ver"); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dataSource.setURL("jdbc:sqlser= ver://sdwivedi63ks022:1433;sendStringParametersAsUnicode=3Dfalse"); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dataSource.setDatabaseName("hi= malaya"); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 poolProperties.setDataSource(d= ataSource); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 final String jdbcInterceptors = =3D "org.apache.tomcat.jdbc.pool.interceptor.StatementCache(prepared=3Dtrue= ,callable=3Dtrue)"; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 poolProperties.setJdbcIntercep= tors(jdbcInterceptors); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 final org.apache.tomcat.jdbc.p= ool.DataSource pooledOracleDatasource =3D new org.apache.tomcat.jdbc.pool.X= ADataSource(poolProperties); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 final javax.sql.DataSource ora= cleDataSource =3D new org.apache.openejb.resource.jdbc.managed.xa.ManagedXA= DataSource(pooledOracleDatasource, transactionManager, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 TransactionProvider.getTransactionSynchronizationRegistr= y()); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Connection connection =3D orac= leDataSource.getConnection(); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (int i =3D 0; i < 50; i++)= { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Prepar= edStatement preparedStatement =3D connection.prepareStatement("insert into = MyTableNew values (" + i + ")"); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 System= .out.println(preparedStatement.getClass().getName()); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 prepar= edStatement.execute(); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 prepar= edStatement.close(); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 connection.close(); > =C2=A0=C2=A0=C2=A0 } > {code} > If I run the above program, the output I see is: > com.sun.proxy.$Proxy11 > If I just change the above program to use XA datasource, i.e. > Change the following line > SQLServerDataSource dataSource =3D new com.microsoft.sqlserver.jdbc.SQLS= erverDataSource(); > To > SQLServerXADataSource dataSource =3D new com.microsoft.sqlserver.jdbc.SQ= LServerXADataSource(); > The output is : > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement -- This message was sent by Atlassian JIRA (v7.6.3#76005)