Is it planned for this to be addressed in a future MySQL version?
-------- Original Message -------- Subject: Re: No Data Truncation warning with MM JDBC driver Date: Tue, 27 Nov 2001 12:15:08 -0600 From: "Mark Matthews" <[EMAIL PROTECTED]> To: "Steve Pellegrino" <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> This is a shortcoming with MySQL, as it reports warnings as a string, which varies from version-to-version and language-set to language-set. There is no way for the driver to reliably retrieve warnings from MySQL :( I've tried to support this in the past and it never worked reliably. Ask Monty to add it to the protocol, and I'll support it. For now, I'll add it to the known issues in the README file. Thanks, -Mark ----- Original Message ----- From: "Steve Pellegrino" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 27, 2001 12:12 PM Subject: No Data Truncation warning with MM JDBC driver > Hello, > When attempting to insert data into a VARCHAR field that exceeds the length of that field, the JDBC is supposed to raise a DataTruncation SQLWarning. This is not happening with the MM JDBC driver. I didn't see it as a documented bug. I've verified that the underlying MySQL database is indeed reporting a warning when data is truncated during an insert. > > My configuration is: > MySQL database version 3.23.33 using MM JDBC driver 2.0.7. > Java 1.3.1. > > // Ensure single row inserts produce warnings > mysql> SET SQL_WARNINGS=1 > > // Create table syntax: > mysql> CREATE TABLE test (name VARCHAR(5) NOT NULL PRIMARY KEY) > > // Test valid data: > mysql> INSERT INTO test VALUES ('valid'); > Query OK, 1 row affected (0.00 sec) > > // Long data inserted with truncation: > mysql> INSERT INTO test VALUES ('this is too long'); > Query OK, 1 row affected (0.00 sec) > Records: 1 Duplicates: 0 Warnings: 1 > > // Show truncation: > mysql> select * from test3; > +-------+ > | name | > +-------+ > | inval | > | valid | > +-------+ > 2 rows in set (0.00 sec) > > Of course, I'm executing the above INSERT statements from within my Java program using Statement.executeUpdate(). I never get the DataTruncation (or any SQLException, for that matter) on the second INSERT. > > Is this a known problem? Is there a workaround? > > Best Regards, > Steve Pellegrino > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php