Data truncation throws java.sql.SQLException instead of com.mysql.jdbc.MysqlDataTruncation
Posted by: Jesus Marquez Sanchez
Date: November 30, 2005 06:55AM

Hi,

I'm experiencing the following exception:

java.sql.SQLException: Data truncated for column 'LockedMaterialQuantity' at row 1


I had a look at MySQL pages about this truncation error and found the property "jdbcCompliantTruncation" to be set to FALSE to solve this problem.

It doesn't work basically because the JDBC is not reporting a "com.mysql.jdbc.MysqlDataTruncation" exception. Instead, it is throwing a "java.sql.SQLException" one.

The offending query is setting the column LockedMaterialQuantity to '', which is what this
"jdbcCompliantTruncation" property is for. But the log file is not showing a "com.mysql.jdbc.MysqlDataTruncation" exception at all.

I'm running MySQL Server 5.0.15.
JDBC driver is "mysql-connector-java-3.1.11"
OS: Microsoft Windows 2003 Server SP1
I'm also running Tomcat 5.5.12

Connection URL: jdbc:mysql://localhost:3306/MagazzinoAutomatico?jdbcCompliantTruncation=false
Connection Driver: com.mysql.jdbc.Driver

Any help appreciated.

Regards,
Jesus

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.