You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Dionisio Egiluz Ruiz de Zárate <di...@tinieblas.com> on 2005/09/06 21:58:49 UTC

help me to connect ibatis to one jndi name (connection pool)

i am ttring to configure ibatis for using one connection pool configured 
into my websphere
i have one jndi name (jdbc/dsDIT) and for connect i have into the ibatins 
conf file (SqlMapConfig.xml) this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
 <typeAlias alias="order" type="testdomain.Order" />
 <transactionManager type="JDBC">
  <dataSource type="JNDI">
   <property name="DataSource" value="java:comp/env/jdbc/jdbc/dsDIT" />
  </dataSource>
 </transactionManager>
 <sqlMap resource="DITT01CATEGORIAS.xml"/>
</sqlMapConfig>

but when i test the conection i recibed one exception (initial context 
exception).
i think that it doesn't find the jndi name but i have configure it.

Can you help me?

thanks 



Re: help me to connect ibatis to one jndi name (connection pool)

Posted by Jeff Butler <je...@gmail.com>.
Two things come to mind:
 1. Make sure you've configured the resource reference in your web.xml or 
ejb-jar.xml as appropriate. You've configured iBATIS to use a reference, 
rather than the actual JNDI name (a good thing).
 2. Make sure the iBATIS name matches the resource reference name. You seem 
to have repeated "jdbc" in what you sent.
 Jeff Butler

 On 9/6/05, Dionisio Egiluz Ruiz de Zárate <di...@tinieblas.com> wrote: 
> 
> I run from the IDE, i haven create one war,ear.ç
> I have create one main class for this pourpose.
> whithout using the jndi, usinf the jdbc driver direcktly it conects but i
> cannot use my jndi.
> 
> ----- Original Message -----
> From: "Nathan Maves" <Na...@Sun.COM>
> To: <us...@ibatis.apache.org>
> Sent: Tuesday, September 06, 2005 10:02 PM
> Subject: Re: help me to connect ibatis to one jndi name (connection pool)
> 
> 
> You have to run your application inside the container. I assume that
> you are creating a WAR(or EAR) file and deploying it to websphere.
> If not, you need to.
> 
> How are you running the application?
> 
> Nathan
> 
> On Sep 6, 2005, at 1:58 PM, Dionisio Egiluz Ruiz de Zárate wrote:
> 
> >
> > i am ttring to configure ibatis for using one connection pool configured
> > into my websphere
> > i have one jndi name (jdbc/dsDIT) and for connect i have into the 
> ibatins
> > conf file (SqlMapConfig.xml) this:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE sqlMapConfig
> > PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
> > "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
> > <sqlMapConfig>
> > <typeAlias alias="order" type="testdomain.Order" />
> > <transactionManager type="JDBC">
> > <dataSource type="JNDI">
> > <property name="DataSource" value="java:comp/env/jdbc/jdbc/dsDIT" />
> > </dataSource>
> > </transactionManager>
> > <sqlMap resource="DITT01CATEGORIAS.xml"/>
> > </sqlMapConfig>
> >
> > but when i test the conection i recibed one exception (initial context
> > exception).
> > i think that it doesn't find the jndi name but i have configure it.
> >
> > Can you help me?
> >
> > thanks
> >
> >
> 
> 
> 
> 
>

Re: help me to connect ibatis to one jndi name (connection pool)

Posted by Dionisio Egiluz Ruiz de Zárate <di...@tinieblas.com>.
I run from the IDE, i haven create one war,ear.ç
I have create one main class for this pourpose.
whithout using the jndi, usinf the jdbc driver direcktly it conects but i 
cannot use my jndi.

----- Original Message ----- 
From: "Nathan Maves" <Na...@Sun.COM>
To: <us...@ibatis.apache.org>
Sent: Tuesday, September 06, 2005 10:02 PM
Subject: Re: help me to connect ibatis to one jndi name (connection pool)


You have to run your application inside the container.  I assume that
you are creating a WAR(or EAR) file and deploying it to websphere.
If not, you need to.

How are you running the application?

Nathan

On Sep 6, 2005, at 1:58 PM, Dionisio Egiluz Ruiz de Zárate wrote:

>
> i am ttring to configure ibatis for using one connection pool  configured 
> into my websphere
> i have one jndi name (jdbc/dsDIT) and for connect i have into the  ibatins 
> conf file (SqlMapConfig.xml) this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMapConfig
> PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
> <sqlMapConfig>
> <typeAlias alias="order" type="testdomain.Order" />
> <transactionManager type="JDBC">
>  <dataSource type="JNDI">
>   <property name="DataSource" value="java:comp/env/jdbc/jdbc/dsDIT" />
>  </dataSource>
> </transactionManager>
> <sqlMap resource="DITT01CATEGORIAS.xml"/>
> </sqlMapConfig>
>
> but when i test the conection i recibed one exception (initial  context 
> exception).
> i think that it doesn't find the jndi name but i have configure it.
>
> Can you help me?
>
> thanks
>
>





Re: help me to connect ibatis to one jndi name (connection pool)

Posted by Nathan Maves <Na...@Sun.COM>.
You have to run your application inside the container.  I assume that  
you are creating a WAR(or EAR) file and deploying it to websphere.   
If not, you need to.

How are you running the application?

Nathan

On Sep 6, 2005, at 1:58 PM, Dionisio Egiluz Ruiz de Zárate wrote:

>
> i am ttring to configure ibatis for using one connection pool  
> configured into my websphere
> i have one jndi name (jdbc/dsDIT) and for connect i have into the  
> ibatins conf file (SqlMapConfig.xml) this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMapConfig
> PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
> <sqlMapConfig>
> <typeAlias alias="order" type="testdomain.Order" />
> <transactionManager type="JDBC">
>  <dataSource type="JNDI">
>   <property name="DataSource" value="java:comp/env/jdbc/jdbc/dsDIT" />
>  </dataSource>
> </transactionManager>
> <sqlMap resource="DITT01CATEGORIAS.xml"/>
> </sqlMapConfig>
>
> but when i test the conection i recibed one exception (initial  
> context exception).
> i think that it doesn't find the jndi name but i have configure it.
>
> Can you help me?
>
> thanks
>
>


Re: help me to connect ibatis to one jndi name (connection pool)

Posted by Jason Vinson <vi...@charter.net>.
Hi,

We configure iBatis to use a jndi connection by default as well.  To avoid
including AS vendor specific jars in your build (or even having the AS
running), you can use any of the mock object providers out that that allow
you to create a context.  Here's how we do it with spring's mock object
library:

        // Jakarta DBCP datasource created for testing...
        BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName(drv);
        ds.setUsername(user);
        ds.setPassword(pass);
        ds.setUrl(url);

        // Bind it to a jndi name
        SimpleNamingContextBuilder builder = new
SimpleNamingContextBuilder();
        builder.bind(jndiName, ds);
        builder.activate();

Please note that this should only occur once per test suite, so code
accordingly.

Hope this Helps.
Jason

On 9/6/05 3:58 PM, "Dionisio Egiluz Ruiz de Zárate" <di...@tinieblas.com>
wrote:

> 
> i am ttring to configure ibatis for using one connection pool configured
> into my websphere
> i have one jndi name (jdbc/dsDIT) and for connect i have into the ibatins
> conf file (SqlMapConfig.xml) this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE sqlMapConfig
> PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
> "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
> <sqlMapConfig>
>  <typeAlias alias="order" type="testdomain.Order" />
>  <transactionManager type="JDBC">
>   <dataSource type="JNDI">
>    <property name="DataSource" value="java:comp/env/jdbc/jdbc/dsDIT" />
>   </dataSource>
>  </transactionManager>
>  <sqlMap resource="DITT01CATEGORIAS.xml"/>
> </sqlMapConfig>
> 
> but when i test the conection i recibed one exception (initial context
> exception).
> i think that it doesn't find the jndi name but i have configure it.
> 
> Can you help me?
> 
> thanks 
>