Bug #47615 Incorrect field size returned when using DAO ODBCDirect
Submitted: 24 Sep 2009 14:23 Modified: 7 Dec 2010 3:59
Reporter: Hal Lind Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:ODBC 5.1.5 OS:Windows
Assigned to: Lawrenty Novitsky CPU Architecture:Any
Tags: DAO, ODBCDirec

[24 Sep 2009 14:23] Hal Lind
Description:
The Size property always returns (Actual Defined Field Size) + 1 when inspected from a recordset created using DAO ODBCDirect.

How to repeat:
Please See attached .vbs sample.
[24 Sep 2009 14:24] Hal Lind
Incorrect field size example

Attachment: dao_incorrect_field_size.vbs (, text), 789 bytes.

[5 Oct 2009 10:06] Tonci Grgin
Hi Hal and thanks for your report.

Your script failed for both of us that tested it. My failure is at Set DAO = ...
ActiveX component can't create object: 'DAO.DBEngine', 800A01AD

It fails with both versioned and unversioned form (DAO.DBEngine and DAO.DBEngine.36).
I am using Win2K8x64 as a primary box so it could be that DAO is just removed from there as it's deprecated by MS...

Can you produce test case that can be used on my platform?
[5 Oct 2009 10:08] Tonci Grgin
Both c/ODBC 3.51 and 5.1 fail in same manner from 32-bit command prompt.
[5 Oct 2009 15:49] Hal Lind
Hi Tonci,

Thanks for looking into this. Please try the following:

1) dao360.dll ships with Windows Server 2008. It should be located in:
C:\Program Files (x86)\Common Files\microsoft shared\DAO\dao360.dll. It should already be registered, but just in case:
   Regsvr32 C:\Program Files (x86)\Common Files\microsoft shared\DAO\dao360.dll

2) You may need MSRDO20.DLL. I will attached a copy to this report. Copy the file to C:\Windows\SysWOW64 and Register it:
   Regsvr32 C:\Windows\SysWOW64\MSRDO20.DLL

NOTE: This file can be re-distributed as per Microsoft (See 'Supported Runtime Files to Distribute with Your Application'):
http://msdn.microsoft.com/en-us/vbrun/ms788708.aspx

3) Since you are using 64 bit O/S, then you should be running 32bit version of wscript.exe from C:\Windows\SysWOW64. So to run the script try:
C:\Windows\SysWOW64\wscript.exe dao_incorrect_field_size.vbs

I have tested the above with a 64Bit Windows 2008 server with the 32bit ODBC 5.1.5 driver installed.

This should also fix the issue with http://bugs.mysql.com/bug.php?id=47800
[5 Oct 2009 15:50] Hal Lind
MSRDO20.DLL

Attachment: MSRDO20.DLL (application/x-msdownload, text), 388.50 KiB.

[12 Oct 2009 8:40] Tonci Grgin
Hal, thanks for great how to...

Now, I did all things requested (ie. both servers registered) but I still have *exactly* the same error running your script... I don't know what to think of this now. Ideas?
[12 Oct 2009 8:41] Tonci Grgin
DAO registered

Attachment: Bug47615-DAO.jpg (image/jpeg, text), 10.60 KiB.

[12 Oct 2009 8:41] Tonci Grgin
Same error again

Attachment: Bug47615-Error.jpg (image/jpeg, text), 17.80 KiB.

[12 Oct 2009 8:42] Tonci Grgin
Of course, I registered RDO too (your file).
[12 Oct 2009 8:43] Tonci Grgin
And tried full paths:
C:\Windows\SysWOW64>c:\Windows\SysWOW64\wscript.exe ...bug47615dao.vbs
[12 Oct 2009 9:10] Tonci Grgin
Tried to run as ASP page, same problem:
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/bug47615dao.asp, line 14

800401f3 

Tried both with and without DAO version.
[12 Oct 2009 9:14] Bogdan Degtyariov
verified
varchar(64) column length was displayed as 65.
[12 Oct 2009 9:19] Tonci Grgin
Thanks Bogdan.
[5 Nov 2009 3:18] Bogdan Degtyariov
The problem occurs because the implementation row descriptor (IRD) has octet_lenght as (string_length + 1). For character data, the octet length does not include space for the null-termination character:

http://msdn.microsoft.com/en-us/library/ms713979%28VS.85%29.aspx
[7 Dec 2010 3:59] Bogdan Degtyariov
Thank you for your bug report. This issue has already been fixed in the latest released version 5.1.8 of that product, which you can download at

  http://www.mysql.com/downloads/