This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
i encoutered this error while using databases services in NB 6.9 RC2 : when selecting "view datas" on some tables...I tested several tables, the one's containing "year" fields produce the error. Step to reproduce: create a db and import the following sql code. Then in netbeans services panel > databases > mysql > select the db > right click on the table > show data. Error message : [quote] Error code 0, SQL state S1009: Value '0000' can not be represented as java.sql.Date Line 1, column 1 Execution finished after 0 s, 1 error(s) occurred. [/quote] Here's a faulty table sample : [MYSQL] -- Serveur: localhost -- Version du serveur: 5.1.34 -- Version de PHP: 5.2.9-1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- DB : `test` -- Structure de la table `datetest` CREATE TABLE IF NOT EXISTS `datetest` ( `myid` int(2) unsigned NOT NULL AUTO_INCREMENT, `atext` text NOT NULL , `ayear1` year(4) NOT NULL, PRIMARY KEY (`myid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- table `datetest` Content INSERT INTO `datetest` (`myid`, `atext`, `ayear1`) VALUES (1, 'sometext', 0000); [/MYSQL] Let me know if u need more informations
Thanks for your test-case, I'll look on it.
Also reproducible in JDeveloper with the same driver. Seems a bug in MySQL driver - mysql-connector-java-5.1.6-bin.jar
Btw, neither the latest MySQL driver(http://dev.mysql.com/downloads/connector/j/) doesn't solve this problem yet.
hey! i found something it seems to be related with an invalid date (0000 is not a valid year, 2010 is) it can be forced using "ALLOW_INVALID_DATES" in a mysql query/server option to disable this full checking of dates more info @ http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_allow_invalid_dates in my scripts, i was forced to use : allowing to use not valid dates. @mysql_query("SET SESSION SQL_MODE='ALLOW_INVALID_DATES';"); After some more testing i found that : year->0000 produce the error year->2010 doesn't produce the error ... BUT ... the year column is showed/converted into a "full date" value and not just Year value. (Instead of showing 2010 in the columns of viewed tables, it shows 2010-01-01) So if you have valid dates, all is fine. It helps but doesn't fix coz tables containing 0000 in a YEAR column will still produce the error in NB. hope it can help to see clear ;) thanx for your investigations, bye
Please see "zeroDateTimeBehavior" option of the mysql-jdbc driver. Setting it to "convertToNull" should fix the symptoms of your problem - reporting dates of this type as null.