Forum Discussion

Stefanssce's avatar
Stefanssce
Copper Contributor
Sep 12, 2023
Solved

SQL Server 2022 create external data source with Oracle TNS files (introduced with CU2)

Hi, I am trying to set up an external data source to connect to Oracle. This works fine when I specify the Oracle hostname like "LOCATION = 'oracle://oracle1:1521". In our setup we normally us ...
  • Stefanssce's avatar
    Sep 12, 2023
    After a lot of try and error I managed to get it working. Here the example which might help others:

    --SQL
    CREATE EXTERNAL DATA SOURCE OracleSource
    WITH ( LOCATION = 'oracle://ORA_TEST' , connection_options = 'ServerName=ORA_TEST;TNSNamesFile=C:\ORA\TNS_ADMIN\tnsnames.ora',
    PUSHDOWN = ON,
    CREDENTIAL = cred_oracle)

    --TNSNAMES.ORA which is store in C:\ORA\TNS_ADMIN

    ORA_TEST =
    (DESCRIPTION =
    (CONNECT_TIMEOUT = 3)
    (ENABLE = BROKEN)
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle1.yourdomain.net )(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle2.yourdomain.net )(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORA_TEST)
    )
    )



Resources