4 messages in com.mysql.lists.javaRE: Problem with insert multiple
FromSent OnAttachments
José Bernardo Velásquez Alzate22 Dec 2004 06:19 
Alec...@Quantel.Com22 Dec 2004 06:47 
Rhino22 Dec 2004 07:05 
José Bernardo Velásquez Alzate22 Dec 2004 07:50 
Subject:RE: Problem with insert multiple
From:José Bernardo Velásquez Alzate (jose@trebol.com.co)
Date:12/22/2004 07:50:38 AM
List:com.mysql.lists.java

THANKS

NOW I HAVE RESOLVED THE PROBLEM -->> SPECIALS THANKS TO: Alec@Quantel.Com

MERRY CHRISTMAS.

-----Mensaje original----- De: José Bernardo Velásquez Alzate [mailto:jose@trebol.com.co] Enviado el: Miércoles, 22 de Diciembre de 2004 09:20 a.m. Para: ja@lists.mysql.com Asunto: Problem with insert multiple

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