1

I'm installing an application which needs an Oracle DB on my server. The DB is hosted on another dedicated server.

The application is using JDBC to connect to the DB.

I have tested the connection with sqlplus and the result is ok with and without tnsnames.ora :

export TNS_ADMIN=/opt/oracle/network/admin
export ORACLE_SID=MYDB    
sqlplus user@MYDB

is ok.

Without tnsnames.ora I can also connect to the DB:

sqlplus user/pwd@server:1521/MYDB

is working fine.

But when I connect through jdbc java driver, the connection is with the following exception:

-------- Oracle JDBC Connection Testing ------
Oracle JDBC Driver Registered!
Connection Failed! Check output console
java.sql.SQLRecoverableException: No more data to read from socket
        at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:456)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:397)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:437)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:954)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:639)
        at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at OracleJDBC.main(OracleJDBC.java:29)

By deactivating the firewalld service, the connection is OK with JDBC.

In the firewalld, I have created the following "oracle" service (in /etc/firewalld/services):

[root@frtls3dxr2017-i 1]# ll /etc/firewalld/services/oracle.xml
-rw-r----- 1 root root 196 Jun 15 10:00 /etc/firewalld/services/oracle.xml
[root@frtls3dxr2017-i 1]# ll /etc/firewalld/services/oracle.xml
-rw-r----- 1 root root 196 Jun 15 10:00 /etc/firewalld/services/oracle.xml
[root@frtls3dxr2017-i 1]# firewall-cmd --list-services
tomee_fcsremote http 3dnotification tomee_3dcomment tomee_fedsearch dhcpv6-client tomee_3dspaceinternal tomee_3ddashboard tomee_3dpassport tomee_3dspace ssh https oracle tomee_fcscentral
[root@frtls3dxr2017-i 1]# cat /etc/firewalld/services/oracle.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>oracle port for jdbc</short>
  <description>oracle
    Firewall rules</description>
  <port protocol="tcp" port="1521"/>
</service>

Do I need to add more port in the service xml file to allow connection to the DB (outgoing traffic)?

zeropouet
  • 11
  • 1

1 Answers1

0

It was not a firewall issue.

The problem was with the rngd service not using /dev/urandom. I had to modify the service unit file to add -r /dev/urandom:

ExecStart=/sbin/rngd -f -r /dev/urandom

It could also be solved by changing the java.security securerandom.source key:

securerandom.source=file:/dev/urandom

zeropouet
  • 11
  • 1