update call with jdbc
Posted in 2000
Topics: Connectivity: ODBC / JDBC / .NET, Connectivity: ESQL/C, 4GL & Embedded SQL, Java & JDBC Development
hi I'm using jdbc to connect to an existing informix database and have real troubles with executing an update command. the following is a printout of my console. as you can see, the select works fine, but the update produces an exception. X:\\>java dbconnection.SQLClient psql> open Database connection could be created! psql> select AufNr, AufIdVrLinie from T_AufAuftrag where AufNr = 20 Cols: 2 aufnr | aufidvrlinie | ---------------| ---------------| 20 | 0 | psql> UPDATE T_AufAuftrag SET AufIdVrLinie = 1 WHERE AufNr = 20; While updating table: java.sql.SQLException at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:308) at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1227) at com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1147) at com.informix.jdbc.IfxResultSet.executeQuery(IfxResultSet.java:218) at com.informix.jdbc.IfxStatement.executeQueryImpl(IfxStatement.java:707) at com.informix.jdbc.IfxStatement.executeQuery(IfxStatement.java:117) at dbconnection.InformixConnection.updateSQL(InformixConnection.java:76) at dbconnection.SQLClient.execCmd(SQLClient.java:95) at dbconnection.SQLClient.<init>(SQLClient.java:42) at dbconnection.SQLClient.main(SQLClient.java:28) this is the implementation of the update call: stmt = con.createStatement(); stmt.executeQuery(update); where update is the whole update command from above. there can't be many things wrong and i took the code from the informix examples. so the only possible error source could be the SQL statement. i just can't finde the mistake. have you got an idea? thanks for any help! tom
Thomas G'nter <thomas.guenter@isoe.ch> ''''' ' ''''''''':3A0AE0A0.C2098037@isoe.ch... > hi > > I'm using jdbc to connect to an existing informix database and have real > troubles with executing an update command. the following is a printout > of my console. as you can see, the select works fine, but the update > produces an exception. > > > X:\\>java dbconnection.SQLClient > psql> open > Database connection could be created! > > psql> select AufNr, AufIdVrLinie from T_AufAuftrag where AufNr = 20 > Cols: 2 > aufnr | aufidvrlinie | > ---------------| ---------------| > 20 | 0 | > > psql> UPDATE T_AufAuftrag SET AufIdVrLinie = 1 WHERE AufNr = 20; > While updating table: > java.sql.SQLException > at > com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:308) > at > com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1227) > at > com.informix.jdbc.IfxSqli.executeStatementQuery(IfxSqli.java:1147) > at > com.informix.jdbc.IfxResultSet.executeQuery(IfxResultSet.java:218) > at > com.informix.jdbc.IfxStatement.executeQueryImpl(IfxStatement.java:707) > at > com.informix.jdbc.IfxStatement.executeQuery(IfxStatement.java:117) > at > dbconnection.InformixConnection.updateSQL(InformixConnection.java:76) > at dbconnection.SQLClient.execCmd(SQLClient.java:95) > at dbconnection.SQLClient.<init>(SQLClient.java:42) > at dbconnection.SQLClient.main(SQLClient.java:28) > > > this is the implementation of the update call: > > stmt = con.createStatement(); > stmt.executeQuery(update); Try to call stmt.executeUpdate(update) instead > > where update is the whole update command from above. there can't be many > things wrong and i took the code from the informix examples. so the only > possible error source could be the SQL statement. i just can't finde the > mistake. have you got an idea? > > thanks for any help! > > tom >