Skip navigation links

MySQL Forums :: Microsoft SQL Server :: com.mysql.jdbc.MysqlDataTruncation: Data truncation:


Advanced Search

com.mysql.jdbc.MysqlDataTruncation: Data truncation:
Posted by: jegadeeswari R ()
Date: October 17, 2006 04:44AM

Regarding the MysqlDataTruncation issue, I am having trouble over-riding it with:
url=jdbc:mysql://localhost/mysql?jdbcCompliantTruncation=false

I am still getting the exception thrown in some cases:
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value adjusted for column 'some_field' at row 1


However sometimes it is thrown and sometimes not. With building my connection like:

String url=("jdbc:mysql://localhost/mydb");
Properties p = new Properties();
p.setProperty("user","myusername");
p.setProperty("password","mypassword");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection(url,p);

My result is:

MySQL 4.1 on WindowsXP - exception is not thrown

--> MySQL 5.0.18 on WindowsXP - exception *IS THROWN*

At least, this is my experience. On the MySQL 5.0.18 on WindowsXP I also tried this:

String url=("jdbc:mysql://localhost/mydb");
Properties p = new Properties();
p.setProperty("user","myusername");
p.setProperty("password","mypassword");
p.setProperty("jdbcCompliantTruncation","false"); //new line
Connection conn = DriverManager.getConnection(url,p);


I still get the exception thrown.
Also if I just try to change things like:

String url=("jdbc:mysql://localhost/mydb");
String user=("myusername");
String password=("mypassword");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection(url, user, password);


I still get the exception on MySQL 5.0.18 on Windows, but nowhere else. How can I get the Windows w/ MySQL 5.0.18 to ignore this exception...that is, without going through my code to find instances where I am passing data larger than the field size? That is the long-term goal, but for now I am hoping to over-ride the exception. My attempts at jdbcCompliantTruncation=false have failed.

Let me know , how could i rectify this exception.

Thanks & Regards,
R.jegadeeswari

Options: ReplyQuote


Subject Written By Posted
com.mysql.jdbc.MysqlDataTruncation: Data truncation: jegadeeswari R 10/17/2006 04:44AM


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.