Bom dia pessoal estou com um probleminha ao salvar os valores de credito e debito dentro do banco aparece a seguinte mensagem alguem poderia me ajuda
org.postgresql.util.PSQLException: ERROR: invalid input syntax for type double precision: “150.000,00”
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:282)
at view.JDialogEdiLivroCaixa.salvarLancamento(JDialogEdiLivroCaixa.java:280)
at view.JDialogEdiLivroCaixa.jbNovoActionPerformed(JDialogEdiLivroCaixa.java:219)
at view.JDialogEdiLivroCaixa.access$000(JDialogEdiLivroCaixa.java:21)
private static String formatarValor(String valor) {
DecimalFormat formatador = new DecimalFormat("##,##00.00");
String s = formatarValor(valor);
s = s.replace(',', '.');
return s;
}
private void salvarLancamento() {
java.sql.Connection con = null;
try {
con = Factory.ConnectionFactory.getConexaoMysql();
} catch (SQLException ex) {
Logger.getLogger(JDialogCadUsuario.class.getName()).log(Level.SEVERE, null, ex);
}
//Inserindo os dados
Date data = null;
try {
data = formatarData(this.txtdata.getText());
} catch (ParseException ex) {
System.out.println("erro ao formartar a data1" + ex);
}
String historico = this.txthistorico.getText();
String credito = this.txtcredito.getText();
String debito = this.txtdebito.getText();
String sql = "insert into fluxocaixa (data_lanc,historico,credito,debito)values"
+ "('" + data + "','" + historico + "','" + credito + "','" + debito + "')";
try {
java.sql.Statement smt = con.createStatement();
smt.executeUpdate(sql);
System.out.println(sql);
smt.close();
con.close();
JOptionPane.showMessageDialog(null, "Registro salvo com sucesso!!!");
} catch (Exception e) {
e.printStackTrace();
}
}
esse é o codigo eu ate usei o metodo formatarValor mais nao consegui