Re: Data truncation throws java.sql.SQLException instead of com.mysql.jdbc.MysqlDataTruncation
Hi,
I have attached a test case and the output:
<%@ page language="java" import="java.util.*, java.sql.*" %>
<HTML>
<HEAD>
<TITLE>e-Mag.</TITLE>
</HEAD>
<BODY>
<%
String driverMySql = "com.mysql.jdbc.Driver";
String urlConnessione = "jdbc:mysql://localhost:3308/MagazzinoAutomatico?jdbcCompliantTruncation=false";
String userName = "user";
String password = "password";
Connection connessione = null;
try {
Class.forName(driverMySql);
connessione = java.sql.DriverManager.getConnection(urlConnessione,userName,password);
Statement statement = connessione.createStatement();
ResultSet risultati = null;
out.println("<pre>-- Before UPDATE-1\n</pre>");
statement.executeUpdate("UPDATE buckets SET MaterialQuantity = '0', LockedMaterialQuantity = '' WHERE DrawerCode='829' AND BucketCode='29' AND WarehouseCode='1'");
out.println("<pre>-- After UPDATE</pre>");
}
catch(Exception e) {
out.println("<pre> " + e + "</pre>");
} finally {
connessione.close();
}
%>
</BODY>
</HTML>
--------------------------------
Output from a WebPage:
-- Before UPDATE-1
java.sql.SQLException: Data truncated for column 'LockedMaterialQuantity' at row 1
--------------------------------
Hope this helps.
Subject
Written By
Posted
November 30, 2005 06:55AM
November 30, 2005 08:31PM
December 01, 2005 01:57AM
Re: Data truncation throws java.sql.SQLException instead of com.mysql.jdbc.MysqlDataTruncation
December 02, 2005 02:03AM
December 09, 2005 12:46PM
December 21, 2005 08:24AM
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.