Professional Documents
Culture Documents
Author : Sethunath. U
Email : sethunathu@gmail.com
References
http://birijan.com.np/?q=Oracle+Heterogeneous+Services+(Accessing+ODBC+data+source) : Birijan Maharajan
Using
Windows XP
Oracle EE 10.2.0.3
MySQL version: 5.0
1. Login to mysql
H:\> mysql -u root mysql -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 5.0.24a-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
2. Grant privileges to root user
Here it can be configured by two methods. We can use either of these two methods.
Create a UDL file (create a text file called msoracle.udl) and save it.
Doubleclick the file to configure the connectivity and configure it as follows.
Select “Use connection string” and click build to select the data source. Select
the data source we created previously (i.e msora35)
[oledb]
; Everything after this line is an OLE DB initstring
Provider=MSDASQL.1;Password=oracle;Persist Security Info=True;User ID=oracle;Extended
Properties="DATABASE=oraclecall;DESCRIPTION=MySQL ODBC 3.51
Driver;DSN=msora35;OPTION=0;PWD=oracle;PORT=0;SERVER=localhost;UID=oracle;";Initial Catalog=oraclecall
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
#
# HS init parameters
HS_FDS_CONNECT_INFO = "UDLFILE=D:/oracle/DB10G/hs/admin/msoracle.udl"
HS_FDS_TRACE_LEVEL = 0
# Environment variables required for the non-Oracle system
#
#set <envvar>=<value>
We can access HS by the SQL*Net listener, not the client. So we must let SQL*Net
know about these services and the programs that proxy Oracle SQL to these ODBC and
OLE DB providers. In the listener.ora file in ORACLE_HOME/network/admin, you should
see an area for SID_LIST_LISTENER, and within that an SID_LIST. In that list, add
the entries for each service, like so
# listener.ora Network Configuration File: D:\ORACLE\DB10G\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\ORACLE\DB10G)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = msora35)
(ORACLE_HOME = D:\ORACLE\DB10G)
(PROGRAM = hsolesql)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = N7224.ibsplc.com)(PORT = 1521))
)
)
hsolesql program access OLE DB. We will be using the hsolesql program for providers
that can process SQL.The ORACLE_HOME directory directs the SQL*Net listener to the
correct installation for that program. Once you make these changes, restart the
listener by entering the following code at the command line:
Lsnrctl stop
Lsnrctl start
# This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
#
# HS init parameters
HS_FDS_CONNECT_INFO = msora35
HS_FDS_TRACE_LEVEL = 0
# Environment variables required for the non-Oracle system
#
#set <envvar>=<value>
We can access HS by the SQL*Net listener, not the client. So we must let SQL*Net
know about these services and the programs that proxy Oracle SQL to these ODBC and
OLE DB providers. In the listener.ora file in ORACLE_HOME/network/admin, you should
see an area for SID_LIST_LISTENER, and within that an SID_LIST. In that list, add
the entries for each service, like so
# listener.ora Network Configuration File: D:\ORACLE\DB10G\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\ORACLE\DB10G)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = msora35)
(ORACLE_HOME = D:\ORACLE\DB10G)
(PROGRAM = hsodbc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = N7224.ibsplc.com)(PORT = 1521))
)
)
hsolesql program access OLE DB. We will be using the hsolesql program for providers
that can process SQL.The ORACLE_HOME directory directs the SQL*Net listener to the
correct installation for that program. Once you make these changes, restart the
listener by entering the following code at the command line:
Lsnrctl stop
Lsnrctl start
7. Configure tnsnames.ora
msora =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA = (SID= msora35))
(HS=OK)
)
8. Validate accessibility
id name
---------- ------------------------
10 John
11 Raju
1 row created.
SQL> commit;
Commit complete.
9. Troubleshooting errors
DECLARE
ret INTEGER;
c INTEGER;
BEGIN
c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@mysql;
DBMS_HS_PASSTHROUGH.PARSE@mysql(c, 'SET SESSION SQL_MODE=ANSI_QUOTES');
ret := DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@mysql(c);
dbms_output.put_line(ret ||' passthrough output');
DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@mysql(c);
END;