Tuesday, December 02, 2008

Oracle - Setting up ODBC / Heterogeneous Database connection to SQL server/Other DB

Basically to setup the connection to the ODBC / Heterogenenous connection, you need to
1) Setup the ODBC system DSN data sources. Remember to put the default database name in the setup. Test the connections after the setup.

2) Goto the $ORACLE_HOME/hs/admin/ folder. Copy the file initodbc.ora and rename it to other name e.g. initHS1.ora. Changed the trace level to OFF and the connect info to your ODBC system DSN name.

e.g.

#
# HS init parameters
#
HS_FDS_CONNECT_INFO = HS1
HS_FDS_TRACE_LEVEL = off


3) Then we configure the listener.ora. Create a new SID entry and put the SID_NAME into the ODBC system DSN name.
e.g.


SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME=HS1) -- Enter the DSN on this line
(ORACLE_HOME = c:\ora10g) -- Enter your Oracle home on this line
(PROGRAM = hsodbc)
)
)

4) Add the hs entry into the tnsnames.ora. e.g.

HS1.world = -- This name can be customized
(DESCRIPTION=
(ADDRESS_LIST=
(Address=(PROTOCOL=TCP)
(HOST=
-- (Server x)
(PORT=1521))) -- Enter the port on which the server x Oracle installation
-- is listening
(CONNECT_DATA=(SID=HS1)) - Enter the DSN name
(HS=OK) -- Enter this value. It tells Oracle to use hetergeneous services
)

5) Stop and then start the Listener. Check to make sure the services is inside the listener.

6) create a database link, to link to the HS services. Remember in SQL server, the " is needed for the username , password and also to specify column name.

e.g.
create [public] database link link_name connect to "user_name" identified by "password" using 'HS1';

7) If you need to setup additional ODBC / HS setup, just follow the same steps with different DSN name.

For detail setup, follow the guide here.
http://www.dba-oracle.com/t_heterogeneous_database_connections_sql_server.htm

No comments: