ok, ok

1)I try fist with simple datasource, like this

<transactionManager type="JDBC" commitRequired="true">
    <dataSource type="SIMPLE">
      <property value="${driver}" name="JDBC.Driver"/>
      <property value="${url}"
name="JDBC.ConnectionURL"/>
      <property value="${username}"
name="JDBC.Username"/>
      <property value="${password}"
name="JDBC.Password"/>      
      <property value="15"
name="Pool.MaximumActiveConnections"/>
      <property value="15"
name="Pool.MaximumIdleConnections"/>
      <property value="1000" name="Pool.MaximumWait"/>
    </dataSource>
  </transactionManager>


2) after that I use BDCP, like this

<transactionManager type="JDBC" commitRequired="true">
    <dataSource type="BDCP">
      <property value="${driver}" name="JDBC.Driver"/>
      <property value="${url}"
name="JDBC.ConnectionURL"/>
      <property value="${username}"
name="JDBC.Username"/>
      <property value="${password}"
name="JDBC.Password"/>      
      <property value="15"
name="Pool.MaximumActiveConnections"/>
      <property value="15"
name="Pool.MaximumIdleConnections"/>
      <property value="1000" name="Pool.MaximumWait"/>
    </dataSource>
  </transactionManager>


3) my iface a implementation is as follow

public interface DireccionInsDao {    
    //
    public void insertDireccion(Direccion direccion);
}

and my concreta clase is

public class DireccionJdbcDao extends JdbcDaoTemplate
implements DireccionInsDao {
    
    //private fields
    private static final String INSERT = 
        "Insert Into Direcciones  " +
        "(id_direccion, cve_mpio, cve_edo,
cve_localidad)  " +
        "values  "  +
        "(0, null, '31', null)  ";


    public DireccionJdbcDao(DaoManager daoManager) {
        super(daoManager);        
    }

    /* (non-Javadoc)
     */
    public void insertDireccion(Direccion direccion) {
        //obtener conexion
        Connection conn = getConnection();
        Statement st = null;
        
        try{
            st = conn.createStatement();
            
            st.executeUpdate( INSERT );
            System.out.println(INSERT + "...okay");
                                                      
     
            int serialValue =
((IfmxStatement)st).getSerial();
            

            
System.out.println("serial value: " + serialValue);
                        
        }catch( SQLException e){
            throw new DaoException("Se ha generado un
error al craer la direccion" + e, e);
        }        
    }
}


raise this....
java.lang.ClassCastException
sep.fmat.sipre.persistent.sqlmapdao.DireccionSqlMapDao.insertDireccion(DireccionSqlMapDao.java:73)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)
        $Proxy1.insertDireccion(Unknown Source)

That's all folk's


--- Clinton Begin <[EMAIL PROTECTED]> wrote:

> I'm really not sure what you're doing here:
> 
> 1) Are you using SimpleDataSource ("SIMPLE"), DBCP,
> or JNDI?  You've
> mentioned all three.  If it's either of the latter
> two, your
> <transactionManager> is incorrect (it's currently
> using
> SimpleDataSource).
> 
> 2) If you're using JNDI to access a DBCP resource in
> Tomcat's setup,
> and you're trying to access it directly using a JNDI
> Context, then
> your question is beyond the scope of iBATIS.
> 
> Can you clarify a little?
> 
> Clinton
> 
> 
> On Thu, 10 Feb 2005 08:55:49 -0800 (PST), Roger
> Baeza
> <[EMAIL PROTECTED]> wrote:
> > I'm trying to use Informix's
> > ((IfmxStatement)stmt.getSerial() to retreive last
> > inserted/update row into Database. But I am having
> > problem with casting.
> > I'm using Tomcat 5.54, JDK 1.4.2, Informix JDBC
> 2.21
> > Here's my code:
> > 
> >      Connection conn = getConnection(); //using
> JNDI
> > connection in Tomcat
> >      Statement stmt = conn.createStatement();
> >      stmt.executeUpdate("INSERT INTO jsp_name
> > values(0,'TESTNAME','TESTDESC')");
> >      int key = ((IfmxStatement)stmt).getSerial();
> >      out.println(">"+key);
> > 
> > I configure as follow
> > 
> > <transactionManager type="JDBC"
> commitRequired="true">
> >     <dataSource type="SIMPLE">
> >       <property value="${driver}"
> name="JDBC.Driver"/>
> >       <property value="${url}"
> > name="JDBC.ConnectionURL"/>
> >       <property value="${username}"
> > name="JDBC.Username"/>
> >       <property value="${password}"
> > name="JDBC.Password"/>
> >       <property value="15"
> > name="Pool.MaximumActiveConnections"/>
> >       <property value="15"
> > name="Pool.MaximumIdleConnections"/>
> >       <property value="1000"
> name="Pool.MaximumWait"/>
> >     </dataSource>
> >   </transactionManager>
> > 
> > What do I have to do with Tomcat's DBCP to get
> this
> > working??? what do I have to get this working?
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Take Yahoo! Mail with you! Get it on your mobile
> phone.
> > http://mobile.yahoo.com/maildemo
> >
> 



                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

Reply via email to