You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sapales <sa...@inicia.es> on 2005/07/05 13:51:12 UTC

Connection Pool

Hi:

I´m working with Tomcat4 and a Connection Pool for accesing MySQL. But,
when I use the following code in a jsp:

<%@ page import ="java.sql.*, javax.sql.*" %>
<%@ page import ="javax.naming.InitialContext, javax.naming.Context" %>

<html><body>
    <%
    Context mInitCtx = null;
    DataSource mDs   = null;
    Connection mConexion = null;
    Statement mStmt  = null;
    ResultSet mRs    = null;

    mInitCtx = new InitialContext();
    mDs = (DataSource) mInitCtx.lookup("java:comp/env/jdbc/PoolConexiones");
    mConexion = mDs.getConnection();
    mStmt = mConexion.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

    mRs = mStmt.executeQuery("SELECT * FROM PRECIOS");
   for(int i=1; i<=10; i++)
    {
        mRs.moveToInsertRow();
        mRs.updateInt("ORDEN",i);
        mRs.insertRow();
        mRs.moveToInsertRow();
    }
    %>
    OK
</body></html>

I get the error: ResultSet not updatable

Why is it?

Thank you


¿Quieres conocer el futuro inmediato de la radio digital? Reportajes y
noticias del mundo de la Tecnología. ¡Ponte al día!

http://tecnologia.tiscali.es/




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Connection Pool

Posted by Elaine <pe...@alaska.com>.
should this be: CONCUR_UPDATEABLE?

Sapales wrote:

> Hi:
> 
> I´m working with Tomcat4 and a Connection Pool for accesing MySQL. But,
> when I use the following code in a jsp:
> 
> <%@ page import ="java.sql.*, javax.sql.*" %>
> <%@ page import ="javax.naming.InitialContext, javax.naming.Context" %>
> 
> <html><body>
>     <%
>     Context mInitCtx = null;
>     DataSource mDs   = null;
>     Connection mConexion = null;
>     Statement mStmt  = null;
>     ResultSet mRs    = null;
> 
>     mInitCtx = new InitialContext();
>     mDs = (DataSource) mInitCtx.lookup("java:comp/env/jdbc/PoolConexiones");
>     mConexion = mDs.getConnection();
>     mStmt = mConexion.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
> 
>     mRs = mStmt.executeQuery("SELECT * FROM PRECIOS");
>    for(int i=1; i<=10; i++)
>     {
>         mRs.moveToInsertRow();
>         mRs.updateInt("ORDEN",i);
>         mRs.insertRow();
>         mRs.moveToInsertRow();
>     }
>     %>
>     OK
> </body></html>
> 
> I get the error: ResultSet not updatable
> 
> Why is it?
> 
> Thank you
> 
> 
> ¿Quieres conocer el futuro inmediato de la radio digital? Reportajes y
> noticias del mundo de la Tecnología. ¡Ponte al día!
> 
> http://tecnologia.tiscali.es/
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Where liberty dwells there is my country.

		---- Ancient Latin phrase ----

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org