Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need Help Connect to MySQL using dg4odbc

Sky13Dec 8 2011 — edited Dec 22 2011
I am looking for some help getting a dblink working from my Oracle 11.1.0.6 Dtabase to a MySQL 5.0.77 Database (Holds Bugzilla).

This is the error I get when I try select * from "bugs"@bugz;

ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[MySQL][ODBC 5.1 Driver][mysqld-5.0.77]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"bug_id" FROM "bugs" A1' at line 1
ORA-02063: preceding 2 lines from BUGZ

On Server hosting Oracle DB:
lsb_release -id
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.7 (Tikanga)

rpm -qa|grep mysql
mysql-connector-odbc-5.1.8-1.rhel5
mysql-5.0.77-4.el5_6.6

tnsping BUGZ
TNS Ping Utility for Linux: Version 11.1.0.6.0 - Production on 08-DEC-2011 07:53:52
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SID = BUGZ)) (HS = OK))
OK (0 msec)

tnsnames.ora
BUGZ =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = BUGZ)
    )
    (HS = OK)
  )
listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
     (SID_DESC =
        (ORACLE_HOME = /u00/app/oracle/product/11.1.0/db_1)
        (SID_NAME = BUGZ)
        (PROGRAM = dg4odbc)
        (ENVS ="LD_LIBRARY_PATH=/u00/app/oracle/product/11.1.0/db_1/lib:/usr/lib64:/usr/lib")
     )
...
/u00/app/oracle/product/11.1.0/db_1/hs/admin/initbugz.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC

#
# HS init parameters
#
HS_FDS_CONNECT_INFO=bugz
HS_FDS_TRACE_LEVEL=off
HS_FDS_SHAREABLE_NAME=/usr/lib64/libmyodbc5.so
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P15
#
# ODBC specific environment variables
#
set ODBCINI=/u00/home/oracle/.odbc.ini


#
# Environment variables required for the non-Oracle system
#
set HOME=/u00/home/oracle
~
/u00/home/oracle/.odbc.ini
[ODBC Data Sources]
[bugz]
Driver      = /usr/lib64/libmyodbc5.so
DATABASE    = bugzilla
DESCRIPTION = MySQL ODBC 5.x Connector
PORT        = 3306
SERVER      = bugzilla
UID         = bugquery
PWD         = password
CHARSET     = latin1
TRACEFILE   = /tmp/myodbc-bugzdsn.trc
TRACE       = OFF
ODBC Test
isql -v bugz
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> help bugs

[Bunch of stuff omitted]

SQLRowCount returns 31
31 rows fetched
SQL>
This post has been answered by Mkirtley-Oracle on Dec 22 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 19 2012
Added on Dec 8 2011
16 comments
4,613 views