#852 ✓resolved
Dan Kubb (dkubb)

Set sql_auto_is_null and sql_mode for jdbc do_mysql

Reported by Dan Kubb (dkubb) | May 15th, 2009 @ 02:00 AM

Currently the jdbc version of do_mysql has different behavior than the C version of do_mysql in that it doesn't send the same commands to configure the session.

With the C version of do_mysql we opted to send over settings that would cause MySQL to act in as strict a mode as possible. MySQL is notorious for silently truncating, transforming and otherwise accepting invalid data that it should be preventing.

Our approach is to have it be as strict as possible now and then scale back if there are problems because it is really difficult to go the other way. In the last few years of developing with MySQL I've found this approach to be quite useful in catching common errors.

On connect the following commands are issued:

SET sql_auto_is_null = 0
SET SESSION sql_mode = 'ANSI,NO_AUTO_VALUE_ON_ZERO,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION,TRADITIONAL'

The do_mysql jdbc driver should send the same commands each time it connects to the server.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by

Pages