Using MySQL 5.0.22, Connector/J 3.12. I have datafields defined as
BIT(1) type, which is supposed to map to java Boolean, which is great
because I am displaying resultset in a jTable and I want the BIT fields
displayed as checkboxes. Displaying data from the resultset is fine.
The problem is with updating the BIT fields. Here is the relevant
portion of the routine: (war_rs is a ResultSet, bleedingCB and
changeMedsCB are checkboxes - the error I get is a data truncation
because BleedingProbs is too large when the insertRow() is executed).
try {
war_rs.moveToInsertRow();
war_rs.updateString("ID",theID);
war_rs.updateString("Date",dateFld.getText());
war_rs.updateString("OldDose",oldDoseFld.getText());
war_rs.updateString("PT",ptFld.getText());
war_rs.updateString("INR",inrFld.getText());
war_rs.updateString("Control",controlFld.getText());
war_rs.updateBoolean("BleedingProbs",bleedingCB.isSelected()); //This
is the field flagged as data truncated
war_rs.updateBoolean("ChangeInMeds",changeMedsCB.isSelected());
war_rs.updateString("Comment",commentFld.getText());
war_rs.updateString("EntryBy",conn.getMetaData().getUserName());
war_rs.insertRow(); // This is the line that actually
generates the error.
updateID(theID);
} catch (SQLException e) {
e.printStackTrace();
}
Nobody - 18 Nov 2006 21:35 GMT
>Using MySQL 5.0.22, Connector/J 3.12. I have datafields defined as
>BIT(1) type, which is supposed to map to java Boolean, which is great
[quoted text clipped - 4 lines]
>changeMedsCB are checkboxes - the error I get is a data truncation
>because BleedingProbs is too large when the insertRow() is executed).
I didn't look at your code but try again with Connector/J 3.1.14. They
fixed a JDBC driver bug for us in that version that was causing data
truncation errors on updates of certain fields. You're likely to get
more help if you post this on the forums at www.MySQL.com
BA