<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Commentaires sur : Se connecter à SQL Server à travers Oracle, quelle drôle d&#8217;idée ?</title>
	<atom:link href="http://blog.capdata.fr/index.php/se-connecter-a-sql-server-a-travers-oracle-quelle-drale-didae/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.capdata.fr/index.php/se-connecter-a-sql-server-a-travers-oracle-quelle-drale-didae/</link>
	<description>Le blog technique sur les bases de données de CAP DATA Consulting</description>
	<lastBuildDate>Fri, 16 Dec 2011 16:49:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Par : Baba</title>
		<link>http://blog.capdata.fr/index.php/se-connecter-a-sql-server-a-travers-oracle-quelle-drale-didae/comment-page-1/#comment-21849</link>
		<dc:creator>Baba</dc:creator>
		<pubDate>Fri, 16 Dec 2011 16:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://192.168.1.220:8080/blogs/oracle/?p=6#comment-21849</guid>
		<description>Très bon article sauf que tout est CLIENT1 dans le tutoriel on ne sait plus quoi correspond à quoi.</description>
		<content:encoded><![CDATA[<p>Très bon article sauf que tout est CLIENT1 dans le tutoriel on ne sait plus quoi correspond à quoi.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : abderrazzak</title>
		<link>http://blog.capdata.fr/index.php/se-connecter-a-sql-server-a-travers-oracle-quelle-drale-didae/comment-page-1/#comment-100</link>
		<dc:creator>abderrazzak</dc:creator>
		<pubDate>Sat, 30 Jan 2010 11:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://192.168.1.220:8080/blogs/oracle/?p=6#comment-100</guid>
		<description>Oracle provided generic connectivity to non-Oracle databases using Heterogeneous Services. HS uses ODBC to connect to the non-Oracle database. You should have MySQL ODBC driver installed on the system.
The following examples are based on MySQL version 3.51.8 for Windows and Oracle 9i (9.2.0.1.0) for Windows.
MuSQL database:
Database used is TEST database which contains table called PET.
 

Setting up ODBC Driver
Configure an ODBC system data source for the target datastore. Use an ODBC client application or ODBC test to verify the connectivity.
Setting up the ODBC connection to the MySQL database requires an odbc.ini file.
My ODBC.INI file has the following entry for [mysql]
[mysql]
Driver32=C:\WINDOWS\System32\myodbc3.dll
SERVER=DEVELOPMENT_06
PORT=3306
USER=root
password=root
database=test
option=3
socket=

Configure tnsnames.ora and listener.ora
Following entries are required in tnsnames.ora and listener.ora
TNSNAMES.ORA (Avialable typically in ORACLE_HOME\NETWORK\ADMIN)
HSMSQL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 197.1.1.31)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = msql)   &lt;-- Should match the SID on listener.ora
    )
    (HS = OK)                 &lt;-- HS clause to use Heterogeneous Services
  )

LISTENER.ORA (Avialable typically in ORACLE_HOME\NETWORK\ADMIN)
# LISTENER.ORA Network Configuration File: c:\oracle\ora91\network\admin\listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC3))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = Development_06)(PORT = 1521))
      )
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = db01)
      (ORACLE_HOME = c:\oracle\ora91)
    )
    (SID_DESC =
      (PROGRAM = hsodbc)                &lt;-- HSODBC is the executable
      (ORACLE_HOME = c:\oracle\ora91)
      (SID_NAME = msql)                  services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC3)))
Services Summary...
Service &quot;db01.shjcustoms.ae&quot; has 1 instance(s).
  Instance &quot;db01&quot;, status READY, has 1 handler(s) for this service...
    Handler(s):
      &quot;DEDICATED&quot; established:1 refused:0 state:ready
         LOCAL SERVER
Service &quot;msql&quot; has 1 instance(s).
  Instance &quot;msql&quot;, status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
      &quot;DEDICATED&quot; established:2 refused:0
         LOCAL SERVER
The command completed successfully
LSNRCTL&gt;


Create Initialization file:
create and customize an initialization file for your generic  connectivity agent. Oracle supplies a sample initialization file named  &quot;inithsodbc.ora&quot; which is stored in the ORACLE_HOME\hs\admin directory. 
To create an initialization file, copy the appropriate sample file and rename  the file to initHS_SID.ora. In this example the sid noted in the listener and  tnsnames is msql so our new initialization file is called initmsql.ora. 

INITMSQL.ORA

# 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 = mysql
HS_FDS_TRACE_LEVEL = 0
#HS_FDS_FILE_NAME=
#HS_FDS_SHARABLE_NAME = c:\windows\system32\myodbc3.lib

#
# Environment variables required for the non-Oracle system
#
#set =

set ODBCINI=C:\WINDOWS\ODBC.INI

Create Database Link
Oracle8i and above have made it mandatory that the database link should have the same name as the targer database. This is achieved by setting a parameter named GLOBAL_NAMES in the init.ora file. Hence if you are creating a database link with name other than the target database you can disable this rule with the following statement:
The following statement will disable global naming for the connected session only!

SQL&gt; alter session set global_names=false;

Session altered.

If you want to disable global naming for all then use:
SQL&gt; alter system set global_names=false;

System altered.

Create a database link to access the target database. Please use the appropriate quotes as noted below. 

SQL&gt; create database link msql connect to &quot;bill&quot; identified by &quot;byte&quot; using &#039;hsmsql&#039;;

Database link created.

SQL&gt; select * from pet@msql;

name                 owner                                srno
-------------------- ------------------------------ ----------
Puffball             James                                   1
PingPong             Bill                                    2
Tennis               Bong                                    3
Cricket              Tim                                     4

4 rows selected.

The above statements were executed by user SYSTEM. If you want any other user to access MySQL database then create a public database link:
SQL&gt; create public database link msql connect to &quot;bill&quot; identified by &quot;byte&quot; using &#039;hsmsql&#039; ;

Database link created.

SQL&gt; conn scott/tiger@db01
Connected.
SQL&gt; select * from pet@msql;

name                 owner                                srno
-------------------- ------------------------------ ----------
Puffball             James                                   1
PingPong             Bill                                    2
Tennis               Bong                                    3
Cricket              Tim                                     4

4 rows selected.</description>
		<content:encoded><![CDATA[<p>Oracle provided generic connectivity to non-Oracle databases using Heterogeneous Services. HS uses ODBC to connect to the non-Oracle database. You should have MySQL ODBC driver installed on the system.<br />
The following examples are based on MySQL version 3.51.8 for Windows and Oracle 9i (9.2.0.1.0) for Windows.<br />
MuSQL database:<br />
Database used is TEST database which contains table called PET.</p>
<p>Setting up ODBC Driver<br />
Configure an ODBC system data source for the target datastore. Use an ODBC client application or ODBC test to verify the connectivity.<br />
Setting up the ODBC connection to the MySQL database requires an odbc.ini file.<br />
My ODBC.INI file has the following entry for [mysql]<br />
[mysql]<br />
Driver32=C:\WINDOWS\System32\myodbc3.dll<br />
SERVER=DEVELOPMENT_06<br />
PORT=3306<br />
USER=root<br />
password=root<br />
database=test<br />
option=3<br />
socket=</p>
<p>Configure tnsnames.ora and listener.ora<br />
Following entries are required in tnsnames.ora and listener.ora<br />
TNSNAMES.ORA (Avialable typically in ORACLE_HOME\NETWORK\ADMIN)<br />
HSMSQL =<br />
  (DESCRIPTION =<br />
    (ADDRESS_LIST =<br />
      (ADDRESS = (PROTOCOL = TCP)(HOST = 197.1.1.31)(PORT = 1521))<br />
    )<br />
    (CONNECT_DATA =<br />
      (SERVICE_NAME = msql)   &lt;&#8211; Should match the SID on listener.ora<br />
    )<br />
    (HS = OK)                 &lt;&#8211; HS clause to use Heterogeneous Services<br />
  )</p>
<p>LISTENER.ORA (Avialable typically in ORACLE_HOME\NETWORK\ADMIN)<br />
# LISTENER.ORA Network Configuration File: c:\oracle\ora91\network\admin\listener.ora<br />
# Generated by Oracle configuration tools.</p>
<p>LISTENER =<br />
  (DESCRIPTION_LIST =<br />
    (DESCRIPTION =<br />
      (ADDRESS_LIST =<br />
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC3))<br />
      )<br />
      (ADDRESS_LIST =<br />
        (ADDRESS = (PROTOCOL = TCP)(HOST = Development_06)(PORT = 1521))<br />
      )<br />
    )<br />
  )</p>
<p>SID_LIST_LISTENER =<br />
  (SID_LIST =<br />
    (SID_DESC =<br />
      (SID_NAME = db01)<br />
      (ORACLE_HOME = c:\oracle\ora91)<br />
    )<br />
    (SID_DESC =<br />
      (PROGRAM = hsodbc)                &lt;&#8211; HSODBC is the executable<br />
      (ORACLE_HOME = c:\oracle\ora91)<br />
      (SID_NAME = msql)                  services<br />
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC3)))<br />
Services Summary&#8230;<br />
Service &laquo;&nbsp;db01.shjcustoms.ae&nbsp;&raquo; has 1 instance(s).<br />
  Instance &laquo;&nbsp;db01&#8243;, status READY, has 1 handler(s) for this service&#8230;<br />
    Handler(s):<br />
      &laquo;&nbsp;DEDICATED&nbsp;&raquo; established:1 refused:0 state:ready<br />
         LOCAL SERVER<br />
Service &laquo;&nbsp;msql&nbsp;&raquo; has 1 instance(s).<br />
  Instance &laquo;&nbsp;msql&nbsp;&raquo;, status UNKNOWN, has 1 handler(s) for this service&#8230;<br />
    Handler(s):<br />
      &laquo;&nbsp;DEDICATED&nbsp;&raquo; established:2 refused:0<br />
         LOCAL SERVER<br />
The command completed successfully<br />
LSNRCTL&gt;</p>
<p>Create Initialization file:<br />
create and customize an initialization file for your generic  connectivity agent. Oracle supplies a sample initialization file named  &laquo;&nbsp;inithsodbc.ora&nbsp;&raquo; which is stored in the ORACLE_HOME\hs\admin directory.<br />
To create an initialization file, copy the appropriate sample file and rename  the file to initHS_SID.ora. In this example the sid noted in the listener and  tnsnames is msql so our new initialization file is called initmsql.ora. </p>
<p>INITMSQL.ORA</p>
<p># This is a sample agent init file that contains the HS parameters that are<br />
# needed for an ODBC Agent. </p>
<p>#<br />
# HS init parameters<br />
#<br />
HS_FDS_CONNECT_INFO = mysql<br />
HS_FDS_TRACE_LEVEL = 0<br />
#HS_FDS_FILE_NAME=<br />
#HS_FDS_SHARABLE_NAME = c:\windows\system32\myodbc3.lib</p>
<p>#<br />
# Environment variables required for the non-Oracle system<br />
#<br />
#set =</p>
<p>set ODBCINI=C:\WINDOWS\ODBC.INI</p>
<p>Create Database Link<br />
Oracle8i and above have made it mandatory that the database link should have the same name as the targer database. This is achieved by setting a parameter named GLOBAL_NAMES in the init.ora file. Hence if you are creating a database link with name other than the target database you can disable this rule with the following statement:<br />
The following statement will disable global naming for the connected session only!</p>
<p>SQL&gt; alter session set global_names=false;</p>
<p>Session altered.</p>
<p>If you want to disable global naming for all then use:<br />
SQL&gt; alter system set global_names=false;</p>
<p>System altered.</p>
<p>Create a database link to access the target database. Please use the appropriate quotes as noted below. </p>
<p>SQL&gt; create database link msql connect to &laquo;&nbsp;bill&nbsp;&raquo; identified by &laquo;&nbsp;byte&nbsp;&raquo; using &#8216;hsmsql&#8217;;</p>
<p>Database link created.</p>
<p>SQL&gt; select * from pet@msql;</p>
<p>name                 owner                                srno<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-<br />
Puffball             James                                   1<br />
PingPong             Bill                                    2<br />
Tennis               Bong                                    3<br />
Cricket              Tim                                     4</p>
<p>4 rows selected.</p>
<p>The above statements were executed by user SYSTEM. If you want any other user to access MySQL database then create a public database link:<br />
SQL&gt; create public database link msql connect to &laquo;&nbsp;bill&nbsp;&raquo; identified by &laquo;&nbsp;byte&nbsp;&raquo; using &#8216;hsmsql&#8217; ;</p>
<p>Database link created.</p>
<p>SQL&gt; conn scott/tiger@db01<br />
Connected.<br />
SQL&gt; select * from pet@msql;</p>
<p>name                 owner                                srno<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-<br />
Puffball             James                                   1<br />
PingPong             Bill                                    2<br />
Tennis               Bong                                    3<br />
Cricket              Tim                                     4</p>
<p>4 rows selected.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

