Bug #32864 MyODBC /Crystal Reports truncated table names, lost fields when names > 21chars
Submitted: 30 Nov 2007 6:24 Modified: 26 Feb 2008 10:48
Reporter: Erica Moss Email Updates:
Status: Closed Impact on me:
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.20, 5.1 OS:Microsoft Windows (xp sp2)
Assigned to: Jess Balint
Tags: regression
Triage: D3 (Medium)

[30 Nov 2007 6:24] Erica Moss
This problem is seen on all 3.51 drivers > 3.51.20 as well as 5.1

When table names are longer than 21 characters, they will be chopped to 21 characters in Crystal Reports.  Multiple tables can still be seen even if the first 21 characters are identical.

When field names are longer than 21 characters, they will also be chopped to 21 characters, however if the first 21 characters are identical, only one table will be visible, the other(s) will be masked.

Neither problem is seen in 3.51.19

The attached ODBC trace was made using the following steps against MyODBC 3.51.20

How to repeat:
CREATE TABLE `twenty character tbl` (c1 int primary key, c2 char);
CREATE TABLE `twenty one char table` (c1 int primary key, c2 char);
CREATE TABLE `twenty two chara tabl1` (c1 int primary key, c2 char);
CREATE TABLE `twenty two chara tabl2` (c1 int primary key, c2 char);
CREATE TABLE `long fields` (`twenty char field001` int primary key,
			 `twenty char field002` int,
			`twenty one char field1` int,
			`twenty one char field2` char);

0. Create a DSN using MyODBC 3.51.20 or greater using database 'crystal'
1. open Crystal Reports (developer or higher)
2. click new report button
3. select 'create new connection'/ODBC and select the DSN created above
4. after it connects, expand the 'crystal' database node

Note: The two 22 character table names are truncated after the 21'st character, but both are visible even though they now appear identical.

5. highlight the table `long fields` and move it to the "selected tables" pane and click Finish
6. if the Field Explorer is not open select View/Field Explorer
7. expand the Database Fields node, and the `long_fields` table node

Note that both of the 21 char fields names are shown but only a single 22 character field name is visible, and its name has been truncated to 21 chars
[30 Nov 2007 6:25] Erica Moss
ODBC trace

Attachment: SQL.LOG (application/octet-stream, text), 125.25 KiB.

[12 Dec 2007 14:41] Kent Comeaux
This is happening to me, too.
[4 Jan 2008 18:30] Tonci Grgin
Eric, 5.1 rev. 986 definitely works with CR XI. Table name used was "atablewithveryverylongnametotestcrystalreportstrunc". However 3.51.23 does not work (name is truncated).
[15 Jan 2008 1:44] Jeff Roberts
Is there any progress on this.  I have encountered the same problem and can't complete a project as a result.

What prior version of the Windows ODBC Controller can we downgrade to?

[31 Jan 2008 18:08] Tonci Grgin
Jeff, it's been worked on. Besides, 5.1 works as expected.
[31 Jan 2008 21:23] Jess Balint
fix + test for 5.1

Attachment: bug32864.diff (application/octet-stream, text), 2.27 KiB.

[1 Feb 2008 7:51] Tonci Grgin
Jess, as I said, "5.1 rev. 986 definitely works with CR XI. However 3.51.23 does not (name is truncated).". So it's 3.51 that needs patch, right?
[1 Feb 2008 23:16] Jess Balint
test to show this also fixes bug#28820

Attachment: bug_28220_test.diff (application/octet-stream, text), 1.11 KiB.

[18 Feb 2008 2:35] Jess Balint
Committed as rev 1036. Will be included in 3.51.24.
[26 Feb 2008 10:48] MC Brown
A note has been added to the 3.51.24 changelog: 

When using Crystal Reports, table and column names would be truncated to 21 characters, and truncated columns in tables where the truncated name was the duplicated would lead to only a single column being displayed.