Note that there are some explanatory texts on larger screens.

plurals
  1. POorg.postgresql.util.PSQLException: ERROR: syntax error near «,» in Java
    text
    copied!<p>The below is the query generate by a prepareStatement in Java:</p> <pre><code>insert into schema.table(cedula, actividad, mercado, venta_mensual, fortalezas, crecer, financiamiento, monto, patente, contador, regimen_tri, problemas, bn_servicios, cursos ) values ('val', 'GAM', 'GAM', '0', 'Calidad', 'Sí', 'Sí', '122', 'Sí', 'Sí', 'ddd', 'aaa','ccc', 'bbb' ) </code></pre> <p>The Java code is:</p> <pre><code>try { PreparedStatement pstmt = conexion.prepareStatement(query); pstmt.setString(1, n.getCedula()); //the rest of the sets of the statement continue here from 1 to 13 pstmt.executeUpdate(); conexion.createStatement().execute(query); return true } catch (SQLException e) { e.printStackTrace(); // This error return false; } </code></pre> <p>The query is executed int the try statement and insert the values properly in the DB, BUT it also throws the below exception, at line 192: here 'val': </p> <pre><code> org.postgresql.util.PSQLException: ERROR: error de sintaxis en o cerca de «,» org.postgresql.util.PSQLException: ERROR: syntax error near ',' java </code></pre> <p>The error trace relate to postgres is here:</p> <pre><code>at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:366) </code></pre> <p>By the way, the table has a bigserial value and all the others values showed in the query. Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload