List:MySQL and Java« Previous MessageNext Message »
From:José Bernardo Velásquez Alzate Date:December 22 2004 2:20pm
Subject:Problem with insert multiple
View as plain text  
Hello 

 

I've a problem with Mysql and java,

 

Here i set the vector in a Javabean

faInSol.setIdPlataforma(vctValor);

faInSol.setIdLicencias(vctClave);

 

Insert the Vector in a map 

pDatos.put("strVerPlataforma", faInSol.getIdPlataforma());

pDatos.put("strVerLicencias", faInSol.getIdLicencias());

 

 

Get the Vector of the Map

Vector vctIdLicencia = (Vector) psDatos.get("strVerLicencias");

Vector vctIdPlataforma = (Vector) psDatos.get("strVerPlataforma");

 

When i try to insert in mysql

 

Object[] objLicencia= vctIdLicencia.toArray();

Object[] objPlataforma= vctIdPlataforma.toArray();

Enumeration iterator = vctIdLicencia.elements();

 

while (iterator.hasMoreElements()) {

intValor++;

                                   

sSQL1.append(" INSERT INTO aodt_solgrupo1_plataf_lice( ");

            sSQL1.append(" Fec_Solicitud, Num_ConsecutivoSol, ");

            sSQL1.append(" Id_Plataforma, Id_Licencia ) ");

            sSQL1.append(" VALUES (Sysdate(),?,?,? ) ");

            ps1 = conexion.prepareStatement(sSQL1.toString());

            ps1.setInt(1, intConsecutivo);

            ps1.setString(2, (vctIdLicencia.get(intValor).toString()).toString());  
///line of problem

            ps1.setString(3, (vctIdPlataforma.get(intValor).toString()).toString());
///line of problem

            ps1.execute(); // line SolicitudServicioDAO.java:263

}

 

show this 

java.sql.SQLException: No value specified for parameter 4

        at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2296)

        at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2249)

        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1319)

        at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:256)

        at
com.eeppm.aod.solicitudServicio.dao.SolicitudServicioDAO.guardarSolicitud(SolicitudServicioDAO.java:263)
// the line is ps1.execute();

 

 

Please help me

 

Thanks


Thread
Problem with insert multiple José Bernardo Velásquez Alzate22 Dec
  • Re: Problem with insert multipleAlec.Cawley22 Dec
  • Re: Problem with insert multiple Rhino22 Dec
RE: Problem with insert multiple José Bernardo Velásquez Alzate22 Dec