Re: Data truncation throws java.sql.SQLException instead of com.mysql.jdbc.MysqlDataTruncation
Posted by: Jesus Marquez Sanchez
Date: December 02, 2005 02:03AM

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.

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.