Java - Ayuda Insertar Datos NetBeans MYSQL

 
Vista:
Imágen de perfil de Jose Castro

Ayuda Insertar Datos NetBeans MYSQL

Publicado por Jose Castro (3 intervenciones) el 29/03/2018 18:14:34
Hola a todos espero puedan ayudarme con este problema que viene presentando
al momento de insertar los datos desde netbeans a mysql aparece este error en la consola:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
run:
Conexion Exitosa Oficial
mar 28, 2018 10:40:22 PM VENTANAS.PantallaPrincipal jButton2ActionPerformed
GRAVE: null
java.sql.SQLException: No value specified for parameter 14
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
	at com.mysql.jdbc.PreparedStatement.checkAllParametersSet(PreparedStatement.java:2560)
	at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2536)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2383)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2312)
	at VENTANAS.PantallaPrincipal.jButton2ActionPerformed(PantallaPrincipal.java:368)
	at VENTANAS.PantallaPrincipal.access$300(PantallaPrincipal.java:19)
	at VENTANAS.PantallaPrincipal$4.actionPerformed(PantallaPrincipal.java:157)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.Component.processMouseEvent(Component.java:6533)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2237)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2295)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
	at java.awt.Container.dispatchEventImpl(Container.java:2281)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

la configuracion de mi conexion es la siguiente:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package VENTANAS;
 
import java.sql.*;
 
public class ConexionBD {
  Connection cn;
 
  public Connection conexion(){
     try{
      Class.forName("com.mysql.jdbc.Driver");
      cn = DriverManager.getConnection("jdbc:mysql://localhost/policia","root","12345");
      System.out.println("Conexion Exitosa Oficial");
  }catch(Exception e){
         System.out.println(e.getMessage());
         }return cn;
  }
 
  Statement createStatement(){
      throw new UnsupportedOperationException("NO SOPORTADO");
  }
}

espero puedan ayudarme amigos a solucionar este problema, solo nesecito solucionar esto para finalizar mi proyecto :(
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Ayuda Insertar Datos NetBeans MYSQL

Publicado por Yamil Bracho (10 intervenciones) el 29/03/2018 18:30:07
Tienes una PreparedStatement donde tienes mas placeholders que valores. Por ejemplo

insert into mi_table values (?, ?, ?)

y le mandas uno o dos parametros nada mas cuando dijiste que iba a tener tres...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de jose castro

Ayuda Insertar Datos NetBeans MYSQL

Publicado por jose castro (3 intervenciones) el 29/03/2018 20:17:08
como lo soluciono amigo? tengo 15 columnas y no le puse valores, por eso los dejo ?,?,?,?,?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar