Bug #5977 MyODBC to multiple databases
Submitted: 8 Oct 2004 11:59 Modified: 30 May 2013 12:31
Reporter: pao Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Windows (Windows Xp)
Assigned to: CPU Architecture:Any

[8 Oct 2004 11:59] pao
Description:
Hi and greetings to MySql developers,

I use:
Windows Xp sp1
MySql-5.0.1-alpha
MyODBC 3.51 Driver
ASP (dll version 6.0.3790.0) on IIS 5.1
ADO 2.8
Internet explorer 6

and I connect to MySql in an ASP application by the ODBC.

The code below:

[CODE] 
Set Conn=Server.Createobject("ADODB.Connection")
strConn = "driver={MYSQL ODBC 3.51 Driver}; " 
strConn = strConn & " server=localhost;port=3306;Option=16834; 
Database=db_cciaa;UID=adm;" 
Conn.Open strConn 

sql = "SELECT SC.COGNOME, NA.VIA FROM DB_CCIAA.TB_SELEZIONATE AS SC LEFT JOIN CED.TB_ANA AS NA ON (SC.COD_FISCALE = NA.CF)" 
set rsProva = conn.execute (sql) 
[/CODE] 

gives the error:

"Microsoft OLE DB Provider for ODBC Drivers (0x80040E37) 
[MySQL][ODBC 3.51 Driver][mysqld-5.0.1-alpha-nt]Table 'db_cciaa.tb_ana' doesn't exist"

How to repeat:
Make two MySql databases ('CED' and 'db_cciaa').
Make the tables 'tb_ana' in 'CED' and 'tb_selezionate' in 'db_cciaa'.
With ADO 2.7, ODBC 3.51 and IIS 5.1 installed, type the code I posted into an asp file, then run it under IE6.

Suggested fix:
I expect the ODBC can find the database named 'ced', considering that I specified the table is on another DB with the syntax NameDatabase.NameTable.
Consider that the SQL typed from Mysql console (DOS command line) works, after the command 'USE db_cciaa'.
[11 Oct 2004 21:34] Harun Eren
The MyODBC-Funktion SQLForeignKey() returns the following results (they are wrong):

The returning values for the following columns at the results are incorrect,
"PKTABLE_CAT" (Position 1), "PKTABLE_NAME" (Position 3),
"PKCOLUMN_NAME" (Position 4), "FKCOLUMN_NAME" (Position 8).

Call MyODBC-Function SQLForeignKeys() and returns Data:

SQLForeignKeys:
`testdbs, , parent`, `id`, testdbs, , child, `parent_id`, 1, 1, 1, NULL, NULL, 7
1 row fetched from 14 columns.
 
The backticks are incorrectly returning in the result for identification the 
foreign keys. It must be changed for correct working in the MyODBC Connector/ODBC.
[11 Oct 2004 22:22] Harun Eren
The last entry of me is an mistake, please does not consider.  This comment was meant for #4564!
Thanks.
[15 Oct 2004 14:12] MySQL Verification Team
Could you please show us your table schema for to test your real case.

Thank you.
[18 Oct 2004 15:22] pao
Hi to you Miguel Solorzano

Here is the tables schema:

DATABASE: CED  TABLE: TB_ANA
INDEXES:
ID is primary index.
CF is non-unique index.
       Name          Type          Possible Null          Extra
       CF            varchar(255)     Yes
       RAGSOC     varchar(255)     Yes
       VIA           varchar(255)     Yes
       CAP           varchar(255)     Yes
       COMUNE     varchar(255)     Yes
       FRAZ          varchar(255)     Yes
       PR             varchar(255)     Yes
       ZONA         varchar(255)     Yes
       SOCIO        varchar(255)     Yes
       GIORNALE    varchar(255)     Yes
       PIVA           varchar(255)     Yes
       CODPAGHE    varchar(255)    Yes
       RAGSOCLEGALE  varchar(255)  Yes
       COMUNELEGALE  varchar(255)  Yes
       id                   int(10)unsigned  No    auto_increment
--------------------------------------------------------
DATABASE: DB_CCIAA  TABLE: TB_SELEZIONATE
INDEXES:
ID is primary index.
Cod_Fiscale is non-unique index.

       Name          Type          Possible Null       Extra
       Id               int(10) unsigned                  auto_increment
       N_prot         int(11)             Yes
       Tipo            varchar(255)     Yes
       Cognome      varchar(255)     Yes
       Nome           varchar(255)     Yes
       Luogo_di_nascita varchar(255)  Yes
       Prov             varchar(255)    Yes
       Data_nasc     date               Yes
       Cod_Fiscale   varchar(255)    Yes
       Data_Ril        date               Yes
       Data_scad     date               Yes
       W                 char(1)           Yes
       Data_Rinn      date               Yes
       gratuita         varchar(255)    Yes
       Anno             smallint(4) unsigned     default:0
       Data_Scad_Vera   date          Yes
       nprot            varchar(10)      Yes
       datalett         varchar(10)      Yes
[8 Nov 2004 13:12] MySQL Verification Team
I was able to repeat with the Option=16834, however when used the
Option=3 that behavior not happens. Please specify how you compound
that option for to find which is the one that arises that error message.

Thanks.
[8 Nov 2004 15:05] pao
Thank you very much.
I tried with option=3 and the error doesn't occur.
The option=16834 is "LONGLONG=INT" option.
However, I tried another time with option=16834, both on localhost and on a remote server, and the error does NOT occur no more... and I can't explain what happened meanwhile, as I didn't change MyOdbc version (3.51.09).
Thank you for your assistance.
[8 Nov 2004 19:07] MySQL Verification Team
Please see below:

16384 	Change LONGLONG columns to INT columns (some applications can't handle LONGLONG).

and you said:

The option=16834 is "LONGLONG=INT" option.
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[30 May 2013 12:31] Bogdan Degtyariov
I'm closing this bug because I can not continue without feedback from the reporter. If you have new info, please reopen the report.