13
Using Microsoft ODBC and Oracle Gateway 1 Installing the Driver Manager An ODBC application makes ODBC calls to the Driver Manager. The Driver Manager carries out a number of tasks for the application such as ensuring the proper driver is loaded/unloaded. You can download the DriverManager from http://www.unixodbc.org . Here I use unixODBC-2.3.0 . 1.1 Copy it to the Linux server and unzip it. 1.2 Change to the unixODBC-2.3.0 directory. 1.3 Execute : export CPPFLAGS="-DSIZEOF_LONG_INT=8" 1.4 Execute : ./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --enable-gui=no --enable-drivers=no -- enable-iconv --with-iconv-char-enc=UTF8 --with-iconv- ucode-enc=UTF16LE

Using microsoft odbc and oracle gateway

Embed Size (px)

Citation preview

Page 1: Using microsoft odbc and oracle gateway

Using Microsoft ODBC and Oracle Gateway

1 Installing the Driver Manager

An ODBC application makes ODBC calls to the Driver Manager. The Driver Manager carries out a number of tasks for the application such as ensuring the proper driver is loaded/unloaded. You can download the DriverManager from http://www.unixodbc.org. Here I use unixODBC-2.3.0 .

1.1Copy it to the Linux server and unzip it. 1.2Change to the unixODBC-2.3.0 directory.1.3Execute : export CPPFLAGS="-DSIZEOF_LONG_INT=8"1.4Execute : ./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --

enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE

Page 2: Using microsoft odbc and oracle gateway

1.5Execute : make

1.6Execute : make install

Page 3: Using microsoft odbc and oracle gateway

2 Installing Microsoft ODBC Driver for SQL Server on Linux

You can download the Microsoft ODBC Driver 11 for SQL Server on Linux from here: https://www.microsoft.com/en-us/download/details.aspx?id=36437

2.1unzip msodbcsql-11.0.2270.0.tar.gz2.2change to msodbcsql-11.0.2270.0

Page 4: Using microsoft odbc and oracle gateway

2.3Execute the command: ./install.sh install 2.4After reviewing the license agreement, type YES to continue with the installation.2.5To verify that the ODBC driver on Linux was registered successfully, execute the following command: odbcinst -q -d -n "ODBC Driver 11 for SQL Server".

Page 5: Using microsoft odbc and oracle gateway

3 installing oracle gateway

Oracle Database Gateways provide the ability to transparently integrate with non-Oracle systems from an Oracle environment. You can download it from here: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-2240591.html

3.1Unzip the binaries3.2Change to gateways3.3Execute: ./runinstaller –silent –noconfig –responseFile ./gw.rsp

3.4Execute root.sh

Page 6: Using microsoft odbc and oracle gateway

4 Configuring ODBC and Oracle Gateway

The configuring steps includes:

Configure ODBC DSN Configure the Gateway Initialization Parameter File Configure the Gateway Listener Configure the Database TNS descriptor Create the Database DB Links

4.1 configure /etc/odbc.ini, the /etc/odbc.ini is looks like below, where DEMO is the DSN: [DEMO]Description=Microsoft ODBC Driver 11 for SQL ServerDriver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2270.0Server = 10.96.114.141Port =Language = EnglishDatabase = HUBLogging = 0LogFile =QuotedId = YesAnsiNPW = YesMars_Connection = No

4.2 verify the connectivity of the DSN by sqlcmdsqlcmd –D –S DEMO –U username

4.3 Change to $GATEWAY_HOME/hs/admin, create the initial parameters file, example:

Page 7: Using microsoft odbc and oracle gateway

$vi initDEMO.ora## HS init parameters#HS_FDS_CONNECT_INFO = DEMOHS_FDS_TRACE_LEVEL = debugHS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so#HS_NLS_NCHAR = AMERICAN_AMERICA.US7ASCII#HS_LANGUAGE = AMERICAN_AMERICA.US7ASCII## ODBC specific environment variables#set ODBCINI=/etc/odbc.ini

4.4 Edit the listener.ora file and add new LISTENER for the Gateway:

LISTENER_GW = (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxxxxxxx)(PORT=1525)) )SID_LIST_LISTENER_GW= (SID_LIST= (SID_DESC= (SID_NAME=DEMO) (ORACLE_HOME=/u01/app/oracle/product/11.2.0.1/gateways) (PROGRAM=dg4odbc) ) )

Page 8: Using microsoft odbc and oracle gateway

4.5 Reload/restart the LISTENER for the Gateway

4.6 Edit the tnsnames.ora file to add a connect descriptor for the gateway

DEMO =

(DESCRIPTION=

(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxxxx)(PORT=1525))

(CONNECT_DATA=(SID=DEMO))

(HS=OK)

)

Page 9: Using microsoft odbc and oracle gateway

4.7 Create DB Link by using the TNS string you just created

SQL> create public database link dbl_demo connect to “demo” identified by “demo” using ‘demo’

Appendix: Example of Response file

RESPONSEFILE_VERSION=2.2.1.0.0UNIX_GROUP_NAME="oinstall"FROM_LOCATION="/home/oracle/gateways/stage/products.xml"FROM_LOCATION_CD_LABEL=<Value Unspecified>ORACLE_HOME="/home/oracle/product/11.2.0.1/gateways"ORACLE_BASE=<Value Unspecified>ORACLE_HOME_NAME="OraGtw11g_home1"SHOW_WELCOME_PAGE=trueSHOW_CUSTOM_TREE_PAGE=trueSHOW_COMPONENT_LOCATIONS_PAGE=trueSHOW_SUMMARY_PAGE=trueSHOW_INSTALL_PROGRESS_PAGE=trueSHOW_REQUIRED_CONFIG_TOOL_PAGE=trueSHOW_CONFIG_TOOL_PAGE=trueSHOW_RELEASE_NOTES=trueSHOW_ROOTSH_CONFIRMATION=trueSHOW_END_SESSION_PAGE=trueSHOW_EXIT_CONFIRMATION=trueNEXT_SESSION=falseNEXT_SESSION_ON_FAIL=trueNEXT_SESSION_RESPONSE=<Value Unspecified>DEINSTALL_LIST={"oracle.tg","11.2.0.1.0"}SHOW_DEINSTALL_CONFIRMATION=trueSHOW_DEINSTALL_PROGRESS=trueCLUSTER_NODES={}ACCEPT_LICENSE_AGREEMENT=falseMETALINK_LOCATION=<Value Unspecified>METALINK_USERNAME=<Value Unspecified>METALINK_PASSWORD=<Value Unspecified>PROXY_HOST=""PROXY_PORT=""PROXY_REALM=<Value Unspecified>PROXY_USER=""PROXY_PWD=<Value Unspecified>DONT_PROXY_FOR=<Value Unspecified>TOPLEVEL_COMPONENT={"oracle.tg","11.2.0.1.0"}SHOW_SPLASH_SCREEN=trueoracle_install_db_SID=<Value Unspecified>oracle_install_RACInstall=falseoracle_install_OSDBA=""

Page 10: Using microsoft odbc and oracle gateway

oracle_install_OSOPER=""oracle_install_OSASM=""oracle_install_client_ic_FlattenOracleHome=trueoracle_install_architecture=""oracle_install_comp_clrintg_ode_net_Selected=trueoracle_install_comp_clrintg_ode_net_2_Selected=trueoracle_install_comp_rdbms_dv_Selected=falseoracle_install_comp_rdbms_partitioning_Selected=trueoracle_install_comp_rdbms_dm_Selected=trueoracle_install_comp_rdbms_lbac_Selected=falseoracle_install_comp_rdbms_rat_Selected=trueoracle_install_comp_oraolap_Selected=trueoracle_install_db_LaunchDBCA=<Value Unspecified>oracle_install_db_LaunchODMA=<Value Unspecified>b_launchLocalConfig=<Value Unspecified>oracle_install_db_dbcaCmd=<Value Unspecified>oracle_install_db_dbuaCmd=<Value Unspecified>oracle_install_LaunchNetCA=trueoracle_install_netcaCmd="bin/netca"oracle_install_netcaDeinstCmd=<Value Unspecified>oracle_install_crs_emcaCmd=<Value Unspecified>oracle_install_crs_upgrade_LaunchEMCA=falseoracle_install_db_isHAOrCRSConfigured=falseoracle_install_crs_LaunchASMCA=<Value Unspecified>oracle_install_crs_LaunchOifcfg=<Value Unspecified>oracle_install_crs_LaunchCluvfy=<Value Unspecified>oracle_install_crs_LaunchRootBat=falseoracle_install_crs_crsInstCmd=<Value Unspecified>oracle_install_crs_oifcfgCmd=<Value Unspecified>oracle_install_crs_crsDeinstCmd=<Value Unspecified>oracle_install_crs_crsUpgrdCmd=<Value Unspecified>oracle_install_crs_cluvfyCmd=<Value Unspecified>oracle_install_crs_asmcaCmd=<Value Unspecified>oracle_install_crs_rootBatCmd=<Value Unspecified>oracle_install_crs_configuredCRSHome=<Value Unspecified>oracle_install_crs_installingHomeShared=<Value Unspecified>oracle_install_crs_updnodelistCfsArgInstallingHome=<Value Unspecified>oracle_install_crs_updnodelistCfsArgConfiguredHome=<Value Unspecified>oracle_install_NoMigration=trueoracle_install_RDBMSInstalling=falseoracle_install_db_SetOracleBase=<Value Unspecified>oracle_install_db_UseDBControl=<Value Unspecified>n_configurationOption=<Value Unspecified>oracle_install_crs_InstallOption=<Value Unspecified>oracle_install_db_InstallEdition="EE"oracle_install_db_ConfigurationType=""s_dlgASMCfgDiskGroupName=<Value Unspecified>oracle_install_db_EMEmailAddress=<Value Unspecified>oracle_install_db_EMSMTPServer=<Value Unspecified>oracle_install_crs_OCRPartitionLocation=<Value Unspecified>oracle_install_db_InstallType=""sl_upgradableRACDBInstances={}oracle.install.crs.storageOption=0oracle.install.asm.OSASM=<Value Unspecified>oracle.install.asm.diskGroup.name=""oracle.install.asm.diskGroup.diskDiscoveryString=""oracle.install.asm.diskGroup.disks={}oracle.install.asm.diskGroup.redundancy=""oracle_install_crs_StorageOption=0oracle_install_asm_DiskGroupName=""oracle_install_asm_DiskDiscoveryString=""oracle_install_asm_Disks={}oracle_install_asm_DiskGroupRedundancy=""

Page 11: Using microsoft odbc and oracle gateway

CLUSTER_CONFIGURATION_FILE=<Value Unspecified>oracle_install_crs_OCRRedundancy=<Value Unspecified>oracle_install_crs_VotingDiskRedundancy=<Value Unspecified>ret_PrivIntrList={}oracle_install_crs_ClusterName=""oracle_install_crs_CommaSeparatedNodes=""oracle_install_crs_OCRMirrorLocation=<Value Unspecified>oracle_install_crs_OCRMirrorLocation2=<Value Unspecified>oracle_install_crs_DiskDriveMapping={}oracle_install_crs_OCRDeviceList=""oracle_install_crs_VotingDiskList=""oracle_install_crs_VDSKMirror1Location1=<Value Unspecified>oracle_install_crs_VDSKMirror1Location2=<Value Unspecified>oracle_install_crs_VDSKLocation=<Value Unspecified>oracle_install_crs_SWOnly=<Value Unspecified>oracle_install_LanguageID=""oracle_install_crs_Upgrade=falseoracle_install_crs_ConfigureGNS=falseoracle_install_crs_GNSSubDomain=""oracle_install_crs_GNSVIPAddress=""oracle_install_crs_SCANName=""oracle_install_crs_SCANPortNumber=0oracle_install_crs_FinalInterfaceList={}oracle_install_crs_NodeVips=""s_windowsSystemDirectory=<Value Unspecified>oracle_install_crs_UseIPMI=falseoracle_install_crs_PublicNodeListWithoutDomain={}oracle_install_asm_MigrateASM=falses_recodHTTPPort="2030"oracle_install_9iRACPresent=falseoracle_install_UnixMakePath="/usr/bin/make"oracle_install_installerCmd=""SELECTED_LANGUAGES={"en"}COMPONENT_LANGUAGES={"en"}INSTALL_TYPE="Custom"DEPENDENCY_LIST={"oracle.rdbms.hsodbc:11.2.0.1.0"}net_var=<Value Unspecified>varRemote=<Value Unspecified>varMQM=<Value Unspecified>MQ_MANAGER=<Value Unspecified>oracle.rdbms.tg4adbs:sl_returnVal=<Value Unspecified>oracle.rdbms.tg4ifmx:sl_returnVal=<Value Unspecified>oracle.rdbms.tg4ims:sl_returnVal=<Value Unspecified>oracle.rdbms.tg4msql:sl_returnVal=<Value Unspecified>oracle.rdbms.tg4sybs:sl_returnVal=<Value Unspecified>oracle.rdbms.tg4tera:sl_returnVal=<Value Unspecified>oracle.rdbms.tg4vsam:sl_returnVal=<Value Unspecified>oracle.rdbms.tg4db2:sl_returnVal=<Value Unspecified>