Rop
Rop

Reputation: 3419

OCI, how connect from VM to Autonomous database?

I am trying to setup my first app in Oracle OCI. I have created a VM, and created an Autonomous database. I started with a simple Java/JDBC-app and try connect to the database with mTLS and "Wallet".

For the database I have added my own public-IP and the VM's IP (10.0.0.xx) to the ACL.

It works when I run from own workstation, the app connects to the db as expected.

But when I try run exactly the same java-code from the VM, it "hangs" for >60 secs, then I get the stacktrace below.

I suspect it is a network/firewall issue that blocks the app from reaching the database, but not able to figure it out, what settings to make/change...

Anyone can help?

.....
Caused by: java.sql.SQLRecoverableException: IO Error: Undefined Error
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:854)
        at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:793)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:57)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:747)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:562)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:190)
        at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:155)
        at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:146)
        at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:205)
        at org.springframework.jdbc.datasource.SingleConnectionDataSource.initConnection(SingleConnectionDataSource.java:224)
        at org.springframework.jdbc.datasource.SingleConnectionDataSource.getConnection(SingleConnectionDataSource.java:164)
        at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:159)
        at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:117)
        at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
        ... 11 more
Caused by: oracle.net.ns.NetException: Undefined Error
        at oracle.net.ns.NSProtocolNIO.negotiateConnection(NSProtocolNIO.java:284)
        at oracle.net.ns.NSProtocol.connect(NSProtocol.java:340)
        at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1596)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:588)
        ... 25 more

Upvotes: 0

Views: 379

Answers (1)

Norman Aberin
Norman Aberin

Reputation: 291

It might be your VM's network configuration. Check if you have the following:

  • Service Gateway to All Services in Oracle Service Network
  • Route Table pointing to Service Gateway
  • Route Table is associated to the network your VM belongs
  • Security List Rule allowing requests to go in and out of your Subnet

Upvotes: 0

Related Questions