Unexpected write behaviour
Posted by:
Andrew Priebe ()
Date: October 31, 2009 04:14PM
Hello,
I am having an interesting problem that I cannot seem to get fixed. I am testing a javabean that creates a table with a given number and then writes data to that table. Duplicate entries are allowed in this table. This is accomplished by running the following from the bean code:
s = conn.createStatement();
s.executeQuery("select * from " + idString + ";");
s.executeUpdate("create table " + idString + " (test varchar(10));");
s.executeUpdate("insert into " + idString + " values('"+ pn +"');");
However, when i check the values in the table through the mysql command line, there are two entries of the same 'pn'. As a work around, I was simply going to try something like:
s.executeUpdate("delete from " + idString + " where test='" + pn + "' limit 1;");
However when I execute that statement from inside the bean, both entries are deleted from the table! If I execute this command from inside the command line, then one entry is left and the other is deleted as I would expect. Can anyone point out problem areas? I am using mysql 5.1.39.
Sorry, only registered users may post in this forum.
© 1995-2008 MySQL AB, 2008- Sun Microsystems, Inc.