Problem with dblink from oracle 11g to mysql
535993Jan 19 2011 — edited Jan 31 2011Hi all,
I'm trying to set up Oracle v11.2g DG4ODBC on Solaris 10 Sparc 64bit to access MySQL 5.1 database. Here's what I used:
1. unixODBC driver 2.3.0
2. MySQL ODBC 5.1.8 driver
I created the odbc.ini file and successfully tested the access to MySQL database table using "isql".
Then I created the initmyodbc5.ora file:
#
# HS init parameters
#
HS_FDS_CONNECT_INFO = myodbc5
HS_FDS_TRACE_LEVEL = 4
HS_FDS_TRACE_FILE_NAME = /tmp/initmyodbc5.trc
HS_FDS_SHAREABLE_NAME = /usr/lib/libodbc.so
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P15
#
# ODBC specific environment variables
#
set ODBCINI=/etc/unixodbc/odbc.ini
set SQL_MODE='ANSI_QUOTES'
#
and edited the listener.ora adding:
(SID_DESC =
(PROGRAM = dg4odbc)
(ORACLE_HOME = /home2/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = myodbc5)
(ENVS = LD_LIBRARY_PATH = /opt/mysql/myodbc5/lib: /usr/lib: /home2/oracle/app/oracle/product/11.2.0/dbhome_1/lib)
)
edited tnsnames.ora file adding:
DG4ODBC =
(DESCRIPTION=
(ADDRESS = (PROTOCOL=tcp)(HOST=dbmmp2)(PORT=1521))
(CONNECT_DATA=(SID=myodbc5))
(HS=OK)
)
Restarted the listener.
Next, I created an Oracle public database link for MySQL database.
All seems ok, since when I try to access a mysql table using “select * from view_optimizer_hp@mysql”, I receive the correct answer (this table has 13 columns).
The problem is when I try to compile a package which refers to tables on MySql.
After this compilation (which sometime ends ok, sometime no), if I repeat my first select, it returns only one column!
Note that this package is correctly compiled in oracle 10gr2, where there is a dblink towards the same mysql but built using hsodbc.
In log files I can’t see anything strange.
Any help would be greatly appreciated.
Marisa