Article View: borland.public.jbuilder.database
Article #314Re: default values problem with mysql version 5
From: Anton Jungreuthmayer
Date: Sun, 19 Aug 2007 09:02
Date: Sun, 19 Aug 2007 09:02
51 lines
2840 bytes
2840 bytes
Paul Nichols [TeamB] wrote:
> Anton Jungreuthmayer wrote:
>> Paul Nichols [TeamB] wrote:
>>> Anton Jungreuthmayer wrote:
>>>> I have an application written in java with jBuilder.
>>>>
>>>> This uses JDBC to access a mySQL database which I am converting from
>>>> version 4.1 to version 5.0
>>>>
>>>> When my application tries to INSERT a record but does not specify a
>>>> value for a text field that is defined as NOT NULL with no default
>>>> set the following error message is returned :
>>>>
>>>> Field 'somedata' doesn't have a default value
>>>>
>>>> this doesn't happen with JDBC on mysql 4.1
>>>> It also doesn't happen when I run the command in mysql, or when
>>>> using mySql query browser but only when I connect using JDBC
>>>>
>>>> Any clues ?
>>>>
>>>> Anton
>>>
>>> This is not going to be related to JB, unless you are using the
>>> QueryDataSet, which may or may not work correctly with newer JDBC
>>> implementations.
>>>
>>
>> JDBC driver - 5.0.6
>> java version 1.5.0_04-b05
>
>
> Thanks for this info. The problem has to do with a commit error with V5
> and the newer mySQL database transaction mechanism. It is a bug and has
> been reported.
>
> To get around this issue try setting jdbcCompliantTruncation=false. This
> will prevent the exception from being thrown before it gets to the MySQL
> Server.
>
> See example below:
>
> Class.forName("com.mysql.jdbc.Driver");
> String dburl = "jdbc:mysql://server/TEST";
> String dburlTrunc =
> "jdbc:mysql://server/TEST?jdbcCompliantTruncation=false";
> String dbuser = "TEST";
> String dbpass = "TEST";
> Connection connection = DriverManager.getConnection(dburl, dbuser,
> dbpass);
Thank you so much - that has fixed it.
Technical Details
Message-ID:
<46c80724@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46c5bbd4@newsgroups.borland.com> <46c5c2b8@newsgroups.borland.com> <46c5c3ec$1@newsgroups.borland.com> <46c7e6f4@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1073da,46beccc389838db9 X-Google-Attributes: gid1073da,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Sun, 19 Aug 2007 10:02:29 +0100 From: Anton Jungreuthmayer <anton@junglemajor.co.uk> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.database Subject: Re: default values problem with mysql version 5 References: <46c5bbd4@newsgroups.borland.com> <46c5c2b8@newsgroups.borland.com> <46c5c3ec$1@newsgroups.borland.com> <46c7e6f4@newsgroups.borland.com> In-Reply-To: <46c7e6f4@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 84.43.51.59 Message-ID: <46c80724@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1187514148 84.43.51.59 (19 Aug 2007 02:02:28 -0700) Lines: 51 Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail