[ODBC-32] max_allowed_packet_size error Created: 2016-03-16  Updated: 2016-04-12  Resolved: 2016-04-10

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: None
Affects Version/s: 1.0.5
Fix Version/s: 1.0.6

Type: Bug Priority: Major
Reporter: Fred Taylor Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None
Environment:

Win7/Pro 32bit using VFP9/SP2. MariaDB 10.1.9



 Description   

Error connecting with MariaDB Connector/ODBC 1.0.5, I get an error using a DSN or a connection string from VFP. The "test" the DSN says it connects successfully.

ConnectHandle = SQLSTRINGCONNECT("Driver=

{MariaDB ODBC 1.0 Driver}

;Server=127.0.0.1;UID=root;PWD=secret;DB=test;Port=3306;Options=3;")

The error is:
Connectivity error: Unknown system variable 'max_allowed_packet_size'

and in the logfile, I see an attempt to set "max_allowed_packet_size" to 4096, and the next entry is "Quit". I do see "max_allowed_packet_size" in the debug symbols for the driver.



 Comments   
Comment by Lawrin Novitsky [ 2016-03-16 ]

Thank you for your report. This is a funny bug to some degree, but more than a valid and serious bug.
As a temporary workaround before release of the connector with the fix for this bug if you have the control on the code, I can suggest remove setting of SQL_ATTR_PACKET_SIZE connection attribute. If setting max_packet_size is important for you, you can add initial statement "SET max_allowed_packet=4096" to your DSN, or INITSTMT=

{SET max_allowed_packet=4096}

to your connection string.

Comment by Fred Taylor [ 2016-03-16 ]

I'm sorry, but I'm not sure what/where you mean by the SQL_ATTR_PACKET_SIZE connection attribute. Where/how do I disable that, in the MY.INI? I'm very new to MariaDB/MySQL.

Here's my current MY.INI file contents:
[mysqld]
datadir=C:/Program Files/MariaDB 10.1/data
port=3306
sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
default_storage_engine=innodb
innodb_buffer_pool_size=405M
innodb_log_file_size=50M
event_scheduler=ON
[client]
port=3306

Thanks for your help and patience.

Comment by Lawrin Novitsky [ 2016-03-16 ]

No-no, that is done in C source code of your application. Or in VB code, if it is written in VB. If you are not developer or don't have source code of the application, you won't be able to do that.
Whatever it is written in, but at the end it sets that(SQL_ATTR_PACKET_SIZE) connection attribute using ODBC API. And we have bug in processing of that attribute - we misspelled server variable name, that defines max packet size.
Anyway, it will be fixed in the next release, and hopefully the release will be built and published soon.

Comment by Fred Taylor [ 2016-03-16 ]

Thanks for the explanation. At this point, since I can use the MySQL driver, I can wait until this bug is fixed and released.

I do question how a bug of this sort has not been reported before, as I surely can't be the first to use this driver in Windows. Either that or not many are using it in Windows, or just went to using the MySql driver when they got the error.

Thanks again.

Comment by Lawrin Novitsky [ 2016-03-16 ]

I really think this connection option is set quite rarely.

Comment by Fred Taylor [ 2016-03-16 ]

That the issue. I'm not setting it, it just tries to set it as some kind of default, and since it can't find it, it errors out.

Comment by Lawrin Novitsky [ 2016-03-17 ]

The connector doesn't try to set max_allowed_packet on its own - only if application asks it to. And application can do that only by setting aforementioned connection option.

Comment by Lawrin Novitsky [ 2016-04-10 ]

The fix and the testcase have been pushed to both branches

Comment by Fred Taylor [ 2016-04-11 ]

Thanks for the pretty rapid "fix". However, while the new version (1.06) now loads OK, in trying to retrieve some tables from a MariaDB 10.1.9 database, it crashes VFP with a C0000005 error. In my experience, that's the "catch-all" error code, so it probably won't be much use in finding the issue. I haven't narrowed it down yet as to what it is about the tables it doesn't like. Some tables work fine, even ones with 100K+ rows, but right now it seems to be the total field width of a row or maybe the number of fields. The ones that crash are our customer table (118 fields, 1431 bytes wide), and the inventory table (102 fields, 1701 bytes wide). I need to do more research to see exactly what's happening.

The error occurred with the 32 bit version of the driver, I have not yet tried the 64 bit version. VFP can only use the 32 bit version anyways, but it will be more than just VFP accessing the data (also will be C# .NET , ASP .NET, php and python programs, so will be a mix of 32-bit and 64-bit.

Let me know if there is any other info that may be of use to you.

Comment by Fred Taylor [ 2016-04-11 ]

Looks like the issue is with BIT type fields (1 bit). Removing the BIT fields from the table allows the connector to retrieve data from the table. If there is a bit field, it crashes.

Comment by Lawrin Novitsky [ 2016-04-12 ]

Thanks, I will look into it

Generated at Thu Feb 08 03:25:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.