Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 19423 invoked from network); 18 Jun 2008 16:24:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jun 2008 16:24:19 -0000 Received: (qmail 70876 invoked by uid 500); 18 Jun 2008 16:24:18 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 70864 invoked by uid 500); 18 Jun 2008 16:24:18 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 70853 invoked by uid 99); 18 Jun 2008 16:24:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jun 2008 09:24:18 -0700 X-ASF-Spam-Status: No, hits=2.4 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of clamey@localmatters.com designates 216.241.189.144 as permitted sender) Received: from [216.241.189.144] (HELO mailhost01.ad.corp.localmatters.com) (216.241.189.144) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Jun 2008 16:23:29 +0000 Received: from 10.4.0.152 ([10.4.0.152]) by mailhost01.ad.corp.localmatters.com ([10.200.4.32]) with Microsoft Exchange Server HTTP-DAV ; Wed, 18 Jun 2008 16:23:47 +0000 User-Agent: Microsoft-Entourage/11.3.6.070618 Date: Wed, 18 Jun 2008 10:23:46 -0600 Subject: Re: Check if query exists before executing From: Christopher Lamey To: Message-ID: Thread-Topic: Check if query exists before executing Thread-Index: AcjRX66D7OqilD1SEd2tvwAbY5caEQ== In-Reply-To: <3444c5f90806180825l588e6f9dub529c6d3423059f6@mail.gmail.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org You could look at the database metadata through the Connection: sqlMapClient.getCurrentConnection().getMetaData().getDatabaseXXX() And then use that to call either the Oracle or generic sql. I personally wouldn't go that route because Oracle might change their metadata so it'd break your code. I'd probably go with some kind of application config that's defined along with the DataSource (JNDI, Spring, properties file, whatever): database.vendor=Oracle And then specifically look for that in my code. On 6/18/08 9:25 AM, "Julio Faerman" wrote: > Hello, > > I would like to know if is it possible to check if a query exists > before executing it. > For example, if i am using oracle and have a optimezed query for > oracle, i would like to run: > > sqlMapClient.queryForList("myQuery.oracle"); > > if there is no special query for oracle, i would like to run just the > standard query: > > sqlMapClient.queryForList("myQuery"); > > is it possible to do something like "sqlMapClient.exists/contais(query)" ? > > Thank you, > Julio