Error: The Network Adapter could not establish the connection - spring

I have a problem with a spring boot application. I have a database connection to an Oracle DB on the cloud. The application works when I run the app in local, but when I deploy the application to the cloud the application start well, but it cannot connect to the Oracle DB.
The error that displays the app is: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
Application properties:
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
spring.datasource.username=myuser
spring.datasource.password=mypass
spring.datasource.url=jdbc:oracle:thin:#<ip>:<port>:cdb1
EDITED:
The problem appears when I changed to a new user created with the next script:
connect sys as sysdba
alter session set "_ORACLE_SCRIPT"=true;
CREATE USER myuser IDENTIFIED BY mypass;
GRANT CONNECT TO myuser;
GRANT CONNECT, RESOURCE, DBA TO myuser;
GRANT CREATE SESSION TO myuser ;
GRANT UNLIMITED TABLESPACE TO myuser

Maybe there is a IP whitelist and your local machine is whitelisted, but your cloud host is not.
Can you ssh to the cloud host and ping this cloud db?

Related

Configuring Oracle Db connection String in .net core using Oracle.ManagedDataAccess.Core package

I am trying to connect to an Oracle DB and query a stored procedure in that DB, but I fail to make a connection to the DB. Here is the connection string:
"ConnectionString": "data source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=somehost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=somename)));user id=someuserid;proxy user id=somepuserid;password=somepass;Persist Security Info=true"
But I get this error when I try to open the connection:
ORA-01005: null password given; logon denied
Probably you specified proxy user id, but didn't specify Proxy Password.
Try this (no proxy User ID)
"ConnectionString": "Data Source=//somehost:1521/somename;User ID=someuserid;Password=somepass;"

How to connect to an Oracle database (in Azure Data Factory) using proxy user authentication / connect through?

I'm looking for some help in figuring out the correct syntax to connect to Oracle from ADF using a proxy user authentication.
The setup is:
An integration runtime has been setup to connect to an on-premise Oracle instance
The connection type is on Oracle Service Name
User name and Password are provided.
When simply using the user name / password combination the connection can be established, and the tables in the (proxy) user schema can be viewed.
However, these are not the correct tables as the setup in the Oracle instance is using connect through / proxy user authentication. Usually, the syntax for login is username[schema-you-want-to-work-with] for this but this does not work in Azure Data Factory for me.
I have tried various syntax attempts in the connection JSON, using additional connection properties but not luck. The error message, when logging in with the proxy user authentication, is always
ERROR [28000] [Microsoft][ODBC Oracle Wire Protocol driver][Oracle]ORA-01017: invalid username/password; logon denied ERROR [28000] [Microsoft][ODBC Oracle Wire Protocol driver][Oracle]ORA-01017: invalid username/password; logon denied Activity ID: da224af9-16ad-4674-a4c9-4811be8f726c.
Logging in with SQL Plus or SQL Developer works with the same connection string.
Does anyone have an idea how I can log in with the proxy user and see the normal schema content? I'm thinking it may just be a syntax issue but I'm out of ideas.
Basic successful connection
Unsuccessful connection with connect through

java.sql.SQLException: Cannot create PoolableConnectionFactory

I am getting an issue as poolableconnectionfactory. how to do it and where i did the mistake?can anyone please suggest me.
Your sqldatabase322 user doesn't have permissions to connect to the sqldatabase233 from the 182.72.70.197 IP address.
Connect to your MySQL database server as root user
Execute CREATE USER and GRANT commands like:
CREATE USER 'sqldatabase322'#'182.72.70.197' IDENTIFIED BY 'your_password_here';
GRANT ALL PR on sqldatabase233.* to 'sqldatabase322'#'182.72.70.197' with grant option;
Now you should be able to connect to the database and execute arbitrary queries
Check out MySQL Database and JMeter - How to Test Your Connection article for comprehensive information/troubleshooting options.

Restrict JDBC connection to Oracle server

I have a oracle server which is our disaster recovery server. When I failover my application from primary site to secondary site, we have a downtime window during which we have to bring up the secondary site. When bringing up the application on the secondary site I am getting below error
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
However, when I try to connect from the SQLPLUS it connects successfully with same username and password but it does not work with JDBC. In order to zero on the issue I tried connecting with SQL Developer with same username and password and it shows the same error.
Can somebody please advice what could the setting be on the oracle server which restricts the JDBC connections?
There is the below setting in the oracle database in sqlnet.ora file
SQLNET.ALLOWED_LOGON_VERSION=12
after commenting the above it worked.

Setting up connection between 2 oracle instances for replication

Hi everyone i have problem with setting up connection between two oracle instances for replication. I can connect via sqlplus using string like `
SQL> connect root/12345#orcl1
but I can't create query:
CREATE DATABASE LINK remotedb
CONNECT TO root IDENTIFIED BY 12345
USING 'orcl1';
Also I can't set up it with Oracle database control. The error that I get is username or password of remote master isn't correct.
I don't suppose by any chance that the user "root" is a SYSDBA account on remote DB? If so, you cannot do this. Database links are not allowed to connect to SYSDBA accounts. The link will be created but you will get ORA-01017: invalid username/password.
I resolved the problem by enclosing password in double quotes

Resources