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!

database link from Oracle to MySQL with the use of unixODBC

605926Mar 18 2008 — edited May 24 2010
Hi,

I have 2 servers.

Server A:
- CentOS_5.1 x386
- MySQL 5.1
- unixODBC
- mysql-connector-odbc

Server B:
- CentOS_5.1 x86_64
- Oracle 11g
- unixODBC
- mysql-connector-odbc

I've configured ODBC, so I am able to do "isql <DSN> oracle oracle -v" sucessfully with "root" and "oracle" user on Oracle server. I've configured listener.ora and tnsnames.ora
________________________________________________________________-
I added below lines to listener.ora

SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=mysqlware)
(ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1)
(PROGRAM=dg4odbc)
(ENVS=LD_LIBRARY_PATH=/u01/app/oracle/product/11.1.0/db_1/hs/lib:/usr/lib64/:$ORACLE_HOME/lib)
)
)



and lines below to tnsnames.ora

mysqlware=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=<server's FQDN>)
(PORT=1521)
)
(CONNECT_DATA=
(SID=mysqlware))
(HS=OK))
______________________________________________________________-

The content of $ORACLE_HOME/hs/admin/initmysqlware.ora is

# 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 = mysqlware
HS_FDS_SHAREABLE_NAME = /usr/lib64/libmyodbc3.so
#
# ODBC specific environment variables
#
set ODBCINI=/home/oracle/.odbc.ini
#
# Environment variables required for the non-Oracle system
#
set <envvar>=<value>
______________________________________________________________________

tnsping mysqlware returns.....

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=<server's FQDN>)) (PORT=1521)) (CONNECT_DATA= (SID=mysqlware)) (HS=OK))
OK (10 msec)

______________

when I login to oracle and create PUBLIC DATABASE LINK with command....

create public database link link2mysqlware connect to
2 "oracle" identified by "oracle" using 'mysqlware';
Database link created.

THIS IS WHAT I GET.....

SQL> select * from "emp"@link2mysqlware;
select * from "emp"@link2mysqlware
*
ERROR at line 1:
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from LINK2MYSQLWARE



There is "emp" table in MySQL, from where I can even select with the use of isql command and from this Oracle server.

I would really appreciate some help here.
Thanks in advance.

Tomaz Bracic
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2010
Added on Mar 18 2008
21 comments
30,709 views