I have the wierdest problem an I am at a loss.
The insert function, as for the code underneath, partially works. I say
partially, as I can see that the primary key is actually incremented. But
sometimes the new record fails to show in the table, and when it does
other records are removed. The behaviour is random to the point that I
cannot give a better description. My first thought was that this might
have been related to the use of INNODB tables and the cascade delete
option. But if I insert the record directly from the mysql consolle then
everything works fine ..

What is going on ?
Here is my java code:

----------------------------
Statement st = connection.createStatement();
String sql = "INSERT INTO bb_replies
VALUES('"+userName+"','"+email+"','"+subject+"','"+content+"','"+dateString+"',"+bbclass+","+rootIndex+","+rootIndex+","+replyIndex+",NULL)";


try {



st.executeUpdate(sql);


}catch(SQLException se){
   out.println( se);
}
---------------------------------------------------

here is my mysql INNODB tables

---------------------------------------------------
create table institutions (
  institution char(30) NOT NULL,
  i_key INT NOT NULL auto_increment,
  primary key(i_key)
) TYPE=INNODB;

create table classes (
  i_key INT,
  owner_key INT,
  classname char(20) NOT NULL,
  auditorium_schedule text,
  c_key INT NOT NULL auto_increment,
  primary key (c_key),
  INDEX p_key (owner_key),
  FOREIGN KEY (owner_key) REFERENCES institutions (i_key)
  ON DELETE CASCADE
) TYPE=INNODB;

create table bboard (
  userName char(40),
  email char(20) NOT NULL,
  subject text NOT NULL,
  content text NOT NULL,
  fontType char(20) NOT NULL,
  pinColor char(10) NOT NULL,
  date char(10) NOT NULL,
  c_key INT,
  owner_key INT,
  m_key INT NOT NULL auto_increment,
  primary key(m_key),
  INDEX p_key (owner_key),
  FOREIGN KEY (owner_key) REFERENCES classes (c_key)
  ON DELETE CASCADE
) TYPE=INNODB;

create table bb_replies (
  userName char(40),
  email char(20) NOT NULL,
  subject text NOT NULL,
  content text NOT NULL,
  date char(10) NOT NULL,
  class INT NOT NULL,
  m_key INT NOT NULL,
  owner_key INT NOT NULL,
  dependency_key INT NOT NULL,
  r_key INT NOT NULL auto_increment,
  primary key(r_key),
  INDEX p_key (owner_key),
  FOREIGN KEY (owner_key) REFERENCES bboard (m_key)
  ON DELETE CASCADE
) TYPE=INNODB;
---------------------------------------------------------------


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to