Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 88481 invoked from network); 27 Sep 2007 15:43:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Sep 2007 15:43:09 -0000 Received: (qmail 34255 invoked by uid 500); 27 Sep 2007 15:42:57 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 34244 invoked by uid 500); 27 Sep 2007 15:42:57 -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 34228 invoked by uid 99); 27 Sep 2007 15:42:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Sep 2007 08:42:56 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.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; Thu, 27 Sep 2007 15:45:18 +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 ; Thu, 27 Sep 2007 15:42:36 +0000 User-Agent: Microsoft-Entourage/11.3.6.070618 Date: Thu, 27 Sep 2007 09:42:35 -0600 Subject: Re: How to setup JNDI connection in ibatis From: Christopher Lamey To: Message-ID: Thread-Topic: How to setup JNDI connection in ibatis Thread-Index: AcgBHQY2RNeqEm0QEdyKxQAbY5caEQ== In-Reply-To: <878c6f8e0709270832h7e649ed7p1f8674c2191eeafd@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 I think the use of the Resource element in the server.xml is the same as using the resource-ref element in the web.xml. From the docs: - Configure the name and data type of a resource made available to the application (equivalent to the inclusion of a element in the web application deployment descriptor). So you can probably remove that from your web.xml. As for the exception you're getting, you might need to use the full JNDI name in iBATIS: java:/comp/env/jdbc/AS400B If I remember correctly, Tomcat automatically prepends the "java:/comp/env/" bit to declared JNDI resources. Cheers, Chris On 9/27/07 9:32 AM, "Ashish Kulkarni" wrote: > Hi > This is what i have done, > in my server.xml file i have added in host element > reloadable="true" crossContext="true"> > driverClassName="com.ibm.as400.access.AS400JDBCDriver" maxIdle="2" > maxWait="5000" validationQuery="select * from PODATA" username="userid" > url="jdbc:as400:AS400B/RPTSTEXTDB;naming=system;date format=iso;time > format=hms;prompt=false" maxActive="4" /> > > > Then in web.xml i have added > > DB Connection > jdbc/AS400B > javax.sql.DataSource > Container > > > and in SqlMapConfig.xml i have added > > > > > > > When i start tomcat i get the following error > com.ibatis.sqlmap.client.SqlMapException: There was an error configuring > JndiDataSourceDaoTransactionPool. Cause: javax.naming.NameNotFoundException: > Name jdbc is not bound in this Context > > > > > > > > On 9/27/07, Christopher Lamey wrote: >> >> Hello, >> >> You then need to add a ResourceLink either in conf/context.xml or in the >> webapp's specific context file (if you're using one). >> >> I don't know what version of Tomcat you're using, but here are the JNDI >> docs >> for 5.5: >> >> http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html >> >> PS: I think you can add a resource-env-ref to your webapp's web.xml to >> link >> to the global JNDI resource too, but I usually go with the ResourceLink in >> the context files to avoid mucking with web.xml. >> >> Cheers, >> Chris >> >> On 9/27/07 7:58 AM, "Ashish Kulkarni" wrote: >> >>> Hi >>> I am using tomcat application server, and using the Administator >> application >>> i added JNDI for my database, i found that it had added following entry >> in >>> server.xml file >>> >>> >> name="AS400B" >>> type="javax.sql.DataSource" >>> password="password" >>> driverClassName="com.ibm.as400.access.AS400JDBCDriver" >>> maxIdle="2" >>> maxWait="5000" >>> validationQuery="select * from PODATA" >>> username="userid" >>> url="jdbc:as400:AS400B/RPTSTEXTDB;naming=system;date format=iso;time >>> format=hms;prompt=false" >>> maxActive="4"/> >>> >>> >>> On 9/26/07, Richard Yee wrote: >>>> >>>> You need to set up the connection pool in your application server >>>> configuration. What AppServer are you using? >>>> >>>> -Richard >>>> >>>> Ashish Kulkarni wrote: >>>>> Hi >>>>> I did modify this to look like below >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> But i get following error in tomcat, I have created a data sourse >>>>> AS400B in tomcat >>>>> >>>>> Caused by: javax.naming.NameNotFoundException: Name AS400B is not >>>>> bound in this Context >>>>> at >>>>> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse( >>>> SqlMapConfigParser.java:81) >>>>> at >>>>> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient( >>>> SqlMapClientBuilder.java:62) >>>>> at com.pfizer.maps.data.GetSQLConfigForWeb.getSqlMapInstance >>>>> (GetSQLConfigForWeb.java:49) >>>>> at >>>>> com.pfizer.maps.servlet.Log4JInitServlet.init(Log4JInitServlet.java >> :104) >>>>> at >>>>> org.apache.catalina.core.StandardWrapper.loadServlet( >>>> StandardWrapper.java:1105) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On 9/26/07, *Ashish Kulkarni* >>>> > wrote: >>>>> >>>>> Hi >>>>> Is there any example of setting up ibatis to use JNDI as data >>>> source, >>>>> I have the following, how do i change it to use JNDI >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> And i have SqlMapConfigAS400.properties where i have >>>>> driver=com.ibm.as400.access.AS400JDBCDriver >>>>> >>>>> url=jdbc:as400:AS400B/RPTSTEXTDB;naming=system;date >>>>> format=iso;time format=hms;prompt=false >>>>> >>>>> username=user >>>>> >>>>> password=password >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >> >>