Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/01/2015, 16:26
Avatar de farfamorA
farfamorA
 
Fecha de Ingreso: noviembre-2010
Ubicación: Lima
Mensajes: 136
Antigüedad: 13 años, 5 meses
Puntos: 24
Respuesta: Obtener valor max de jTxt en java y PostgreSQL

¿Y por qué no dejas que el gestor de base de datos sea quien se encargue de colocar el valor del id?
Hay varias formas de hacerlo en PostgreSQL, luego sólo debes hacer lo siguiente en tu código Java.
Código Java:
Ver original
  1. PreparedStatement instruccion = conexion.conexion.prepareStatement("INSERT INTO \"public\".\"Persona\" (columna_nombre, columna_telefono) VALUES (?,?)");
  2. instruccion.setString(1, txt_nombre.getText());
  3. instruccion.setString(2, txt_telefono.getText());
  4. instruccion.executeUpdate();

Salu2.