Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORDS to connect to database using TNSNAMES not working?

Denis SavenkoNov 19 2018 — edited Nov 22 2018

CentOS Linux 7.5

Oracle Database XE 18c

ORDS 18.3

APEX 18.2

My ORDS instance works perfectly fine if I use `basic` type of connection in my `defaults.xml`:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

<properties>

<entry key="db.connectionType">basic</entry>

<entry key="db.hostname">localhost</entry>

<entry key="db.port">1521</entry>

<entry key="db.servicename">XEPDB1</entry>

<entry key="security.requestValidationFunction">wwv_flow_epg_include_modules.authorize</entry>

<entry key="security.validationFunctionType">plsql</entry>

</properties>

However, if I change the connection type property to `tns` like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

<properties>

<entry key="db.connectionType">tns</entry>

<entry key="db.tnsDirectory">/opt/oracle/product/18c/dbhomeXE/network/admin</entry>

<entry key="db.tnsAliasName">pdb1</entry>

<entry key="security.requestValidationFunction">wwv_flow_epg_include_modules.authorize</entry>

<entry key="security.validationFunctionType">plsql</entry>

</properties>

And my tnsnames.ora looks as following:

# tnsnames.ora Network Configuration File: /opt/oracle/product/18c/dbhomeXE/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

XE =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

(CONNECT\_DATA =

  (SERVER = DEDICATED)

  (SERVICE\_NAME = XE)

)

)

PDB1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

(CONNECT\_DATA =

  (SERVER = DEDICATED)

  (SERVICE\_NAME = XEPDB1)

)

)

LISTENER_XE =

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

ORDS won't resolve the descriptor and generates this exception:

IO Error: could not resolve the connect identifier "pdb1"

In my browser window:

screenshot.png

----

Is there anything I am doing wrong or is it a known ORDS issue?

----

P.S. My tnsnames entry works fine in other places, in example with sqlplus:

# sqlplus sys@pdb1 as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Tue Nov 20 00:01:06 2018

Version 18.4.0.0.0

Copyright (c) 1982, 2018, Oracle. All rights reserved.

Enter password:

Connected to:

Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production

Version 18.4.0.0.0

SQL>

This post has been answered by Denis Savenko on Nov 20 2018
Jump to Answer
Comments
Post Details
Added on Nov 19 2018
13 comments
4,087 views