mysql> drop table if exists t1; create table t1 (a varchar(10)) engine=connect table_type=odbc connection='DSN=oraodbc;UID=system;PWD=manager' catfunc=Columns; select * from t1;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.10 sec)
ERROR 2013 (HY000): Lost connection to MySQL server during query
This is a stack trace:
#0 0x0000000000c94792 in VALUE::GetType (this=0x0)
at /home/bar/maria-bzr/maria-10.0-connect/storage/connect/value.h:88
#1 0x0000000000ccb8b4 in VALBLK::ChkTyp (this=0x7fffaf0005a0, v=0x0)
at /home/bar/maria-bzr/maria-10.0-connect/storage/connect/valblk.cpp:177
#2 0x0000000000ccc01c in CHRBLK::SetValue (this=0x7fffaf0005a0, valp=0x0, n=751)
at /home/bar/maria-bzr/maria-10.0-connect/storage/connect/valblk.cpp:559
#3 0x0000000000d065c5 in ODBConn::GetCatInfo (this=0x7fffaf0002c8, cap=0x7fffaf05ede8)
at /home/bar/maria-bzr/maria-10.0-connect/storage/connect/odbconn.cpp:2136
#4 0x0000000000d024dd in ODBCColumns (g=0x7fffb4507000,
"create table t1 (a varchar(10)) engine=connect table_type=odbc connection='DSN=oraodbc;UID=system;PWD=manager' catfunc=Columns;"
The column definition is for a catfunc table, it is not the one of the table that is queried. The simpler is to leave CONNECT define them by not specifying it:
CREATE TABLE `ct1` (
`Table_Qualif` char(128) NOT NULL,
`Table_Owner` char(128) NOT NULL,
`Table_Name` char(128) NOT NULL,
`Column_Name` char(128) NOT NULL,
`Data_Type` smallint(6) NOT NULL,
`Type_Name` char(20) NOT NULL,
`Precision` int(10) NOT NULL,
`Length` int(10) NOT NULL,
`Scale` smallint(6) NOT NULL,
`Radix` smallint(6) NOT NULL,
`Nullable` smallint(6) NOT NULL,
`Remarks` char(128) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ORACLE_TEST;UID=system;PWD=manager' `TABLE_TYPE`='odbc' `TABNAME`='T1' `CATFUNC`='Columns';
Note 1: On windows the wrong catfunc table does not cause a "lost connection" but returns an error message saying:
mysql_store_result failed: Got error 174
'[Oracle][ODBC][ORA]ORA-01406: fetched column value truncated' from CONNECT
Note 2: The Oracle t1 table was created as "create table t1 (a int)". Oracle makes a DECIMAL 38 column a. This is probably the cause of the MDEV-5340 bug.
Note 3: This obviously applies also to any data source including MS SQL Server.
Olivier Bertrand
added a comment - Your create table is incorrect:
"create table t1 (a varchar(10)) engine=connect table_type=odbc connection='DSN=oraodbc;UID=system;PWD=manager' catfunc=Columns;"
The column definition is for a catfunc table, it is not the one of the table that is queried. The simpler is to leave CONNECT define them by not specifying it:
create table ct1 engine=connect table_type=odbc tabname='t1' connection='DSN=oraodbc;UID=system;PWD=manager' catfunc=Columns;
CREATE TABLE `ct1` (
`Table_Qualif` char(128) NOT NULL,
`Table_Owner` char(128) NOT NULL,
`Table_Name` char(128) NOT NULL,
`Column_Name` char(128) NOT NULL,
`Data_Type` smallint(6) NOT NULL,
`Type_Name` char(20) NOT NULL,
`Precision` int(10) NOT NULL,
`Length` int(10) NOT NULL,
`Scale` smallint(6) NOT NULL,
`Radix` smallint(6) NOT NULL,
`Nullable` smallint(6) NOT NULL,
`Remarks` char(128) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='DSN=ORACLE_TEST;UID=system;PWD=manager' `TABLE_TYPE`='odbc' `TABNAME`='T1' `CATFUNC`='Columns';
and "select * from ct1;" returns:
Table_Qualif Table_Owner Table_Name Column_Name Data_Type Type_Name Precision Length Scale Radix Nullable Remarks
<null> SYSTEM T1 A 3 DECIMAL 38 40 0 10 1 <null>
Note 1: On windows the wrong catfunc table does not cause a "lost connection" but returns an error message saying:
mysql_store_result failed: Got error 174
' [Oracle] [ODBC] [ORA] ORA-01406: fetched column value truncated' from CONNECT
Note 2: The Oracle t1 table was created as "create table t1 (a int)". Oracle makes a DECIMAL 38 column a. This is probably the cause of the MDEV-5340 bug.
Note 3: This obviously applies also to any data source including MS SQL Server.
This query without a table definition crashes with Oracle with the same symptoms:
drop table if exists t1;
create table t1 engine=connect table_type=odbc connection='DSN=oraodbc;UID=system;PWD=manager' catfunc=Columns;
select * from t1;
ERROR 2013 (HY000): Lost connection to MySQL server during query
Alexander Barkov
added a comment - This query without a table definition crashes with Oracle with the same symptoms:
drop table if exists t1;
create table t1 engine=connect table_type=odbc connection='DSN=oraodbc;UID=system;PWD=manager' catfunc=Columns;
select * from t1;
ERROR 2013 (HY000): Lost connection to MySQL server during query
The same problem is repeatable with an MS SQL Server data source.