The Network Adapter could not establish connection Oracle 12c - java

I have an oracle12c database setup on my windows 8 machine & I am trying to access this database through JDBC from ubuntu(Linux) machine present in local area network.
When am trying to establish connection through JDBC, getting the following exception
The network adapter could not establish connection.
I have ensured the following.
1. Disabled the firewalls between both the machines.
2. the URL is proper & I tired using both hostname as well as ip address.
3. listener is up and running on port 1521.(lsnrctl stat shows the listener is READY)
I have done extensive google search about this. Please help.
Thanks in advance. Please let me know if you need more details.

make sure you have used proper jdbc driver for that database connection.

try to telnet the computer (Windows 8) that is running DB from client computer (Ubuntu).

Related

how to solve the net work adaption error in java [duplicate]

I am new to Oracle, and am trying to run a simple example code with Java, but am getting this error when executing the code.. I am able to start up the listener via CMD and am also able to run SQL Plus. Can anyone give me a hand and tell me what I might be doing wrong?
Update:
I am using JDBC.
Database is local, and I actually had it working but it stopped working just today. I'm not really sure why though. Would you mind giving me some procedures to follow by since I don't know much.
Either:
The database isn't running
You got the URL wrong
There is a firewall in the way.
(This strange error message is produced by Oracle's JDBC driver when it can't connect to the database server. 'Network adapter' appears to refer to some component of their code, which isn't very useful. Real network adapters (NICs) don't establish connections at all: TCP protocol stacks do that. It would have been a lot more useful if they had just let the original ConnectException be thrown, or at least used its error message and let it appear in the stack trace.)
I had the same problem, and this is how I fixed it.
I was using the wrong port for my connection.
private final String DB_URL = "jdbc:oracle:thin:#localhost:1521:orcll"; // 1521 my wrong port
go to your localhost
(my localhost address) : https://localhost:1158/em
login
user name
password
connect as --> normal
Below 'General' click on LISTENER_localhost
look at you port number
Net Address (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522))
Connect to port 1522
Edit you connection
change port 1521 to 1522.
done
Another thing you might want to check that the listener.ora file matches the way you are trying to connect to the DB. If you were connecting via a localhost reference and your listener.ora file got changed from:
HOST = localhost
to
HOST = 192.168.XX.XX
then this can cause the error that you had unless you update your hosts file to accommodate for this. Someone might have made this change to allow for remote connections to the DB from other machines.
I figured out that in my case, my database was in different subnet than the subnet from where i was trying to access the db.
I had this error when i renamed the pc in the windows-properties. The pc-name must be updated in the listener.ora-file
Most probably you have listener configured wrongly, the hostname you specify in connection string must be the same as in the listener.
First check the Firewall and network related issues.
Check if Oracle Listener service is available and running. If not you may use Oracle Net Configuration Assistant tool to add and register new listener.
If the above steps are ok then you need to configure Oracle Listener appropriately. You may use Oracle Net Manager tool or edit “%ORACLE_HOME%\network\admin\listener.ora” file manually.
There are 2 options that need to be considered carefully:
Listening Locations associated with the Listener – Hostname(IP) and Port in Listening Location must exactly match the ones used in the connection string.
For example, if you use 192.168.74.139 as target hostname, then there must be Listening Location registered with the same IP address.
Also make sure the you use the same SID as indicated in Database Service associated with the Listener.
https://adhoctuts.com/fix-oracle-io-error-the-network-adapter-could-not-establish-the-connection-error/
IO Error: The Network Adapter could not establish the connection (CONNECTION_ID=iKQM6lBbSLiArrYuDqud8A==)
if you are facing this issue
1- make sure you have downloaded oracle databases like oracle 11g,19c, 21c, or any latest databases.
2- search for services in your computer or type win+r then services.mis then search for oracleservice you will find orcl or xe or any other sid like oracleserviceorcl;
after that you can test your connection using sql developer, sql plus or cmd
To resolve the Network Adapter Error I had to remove the - in the name of the computer name.
In my case, I needed to specify a viahost and viauser. Worth trying if you're in a complex system. :)
For me the basic oracle only was not installed. Please ensure you have oracle installed and then try checking host and port.
I was having issues with this as well. I was using the jdbc connection string to connect to the database. The hostname was incorrectly configured in the string. I am using Mac, and the same string was being used on Windows machines without an issue. On my connection string, I had to make sure that I had the full url with the appending "organizationname.com" to the end of the hostname.
Hope this helps.
Just try to re-create connection. In my situation one of jdbc connection stopped working for no reason. From console sqlplus was working ok.
It took me 2 hours to realize that If i create the same connection - it works.

Attempting to connect java application to remote Oracle database using OJDBC8 library [duplicate]

I am new to Oracle, and am trying to run a simple example code with Java, but am getting this error when executing the code.. I am able to start up the listener via CMD and am also able to run SQL Plus. Can anyone give me a hand and tell me what I might be doing wrong?
Update:
I am using JDBC.
Database is local, and I actually had it working but it stopped working just today. I'm not really sure why though. Would you mind giving me some procedures to follow by since I don't know much.
Either:
The database isn't running
You got the URL wrong
There is a firewall in the way.
(This strange error message is produced by Oracle's JDBC driver when it can't connect to the database server. 'Network adapter' appears to refer to some component of their code, which isn't very useful. Real network adapters (NICs) don't establish connections at all: TCP protocol stacks do that. It would have been a lot more useful if they had just let the original ConnectException be thrown, or at least used its error message and let it appear in the stack trace.)
I had the same problem, and this is how I fixed it.
I was using the wrong port for my connection.
private final String DB_URL = "jdbc:oracle:thin:#localhost:1521:orcll"; // 1521 my wrong port
go to your localhost
(my localhost address) : https://localhost:1158/em
login
user name
password
connect as --> normal
Below 'General' click on LISTENER_localhost
look at you port number
Net Address (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522))
Connect to port 1522
Edit you connection
change port 1521 to 1522.
done
Another thing you might want to check that the listener.ora file matches the way you are trying to connect to the DB. If you were connecting via a localhost reference and your listener.ora file got changed from:
HOST = localhost
to
HOST = 192.168.XX.XX
then this can cause the error that you had unless you update your hosts file to accommodate for this. Someone might have made this change to allow for remote connections to the DB from other machines.
I figured out that in my case, my database was in different subnet than the subnet from where i was trying to access the db.
I had this error when i renamed the pc in the windows-properties. The pc-name must be updated in the listener.ora-file
Most probably you have listener configured wrongly, the hostname you specify in connection string must be the same as in the listener.
First check the Firewall and network related issues.
Check if Oracle Listener service is available and running. If not you may use Oracle Net Configuration Assistant tool to add and register new listener.
If the above steps are ok then you need to configure Oracle Listener appropriately. You may use Oracle Net Manager tool or edit “%ORACLE_HOME%\network\admin\listener.ora” file manually.
There are 2 options that need to be considered carefully:
Listening Locations associated with the Listener – Hostname(IP) and Port in Listening Location must exactly match the ones used in the connection string.
For example, if you use 192.168.74.139 as target hostname, then there must be Listening Location registered with the same IP address.
Also make sure the you use the same SID as indicated in Database Service associated with the Listener.
https://adhoctuts.com/fix-oracle-io-error-the-network-adapter-could-not-establish-the-connection-error/
IO Error: The Network Adapter could not establish the connection (CONNECTION_ID=iKQM6lBbSLiArrYuDqud8A==)
if you are facing this issue
1- make sure you have downloaded oracle databases like oracle 11g,19c, 21c, or any latest databases.
2- search for services in your computer or type win+r then services.mis then search for oracleservice you will find orcl or xe or any other sid like oracleserviceorcl;
after that you can test your connection using sql developer, sql plus or cmd
To resolve the Network Adapter Error I had to remove the - in the name of the computer name.
In my case, I needed to specify a viahost and viauser. Worth trying if you're in a complex system. :)
For me the basic oracle only was not installed. Please ensure you have oracle installed and then try checking host and port.
I was having issues with this as well. I was using the jdbc connection string to connect to the database. The hostname was incorrectly configured in the string. I am using Mac, and the same string was being used on Windows machines without an issue. On my connection string, I had to make sure that I had the full url with the appending "organizationname.com" to the end of the hostname.
Hope this helps.
Just try to re-create connection. In my situation one of jdbc connection stopped working for no reason. From console sqlplus was working ok.
It took me 2 hours to realize that If i create the same connection - it works.

Advantage Database Local server with JDBC

Hi I am trying to connect through JDBC on an Advantage local server.
I have tested many connections strings, like for example:
connection = DriverManager.getConnection(
"jdbc:extendedsystems:advantage://localhost:6262;catalog=C:\\bdl\\database\\BDL.add;TableType=cdx;LockType=proprietary", "adssys", "no");
I am searching for over three days now. I am getting always the error message connection refused. I only want to connect and access the files , and not on any advanced database server. I have now idea any more.
The ADS JDBC driver doesn't support ALS (Advantage Local Server), you have to install an actual ADS server.
http://devzone.advantagedatabase.com/dz/webhelp/Advantage10.1/devguide_ads_and_java_1.htm
If you have a running ADS server make sure there is no firewall that blocks traffic on port 6262 (or whatever port you're using).

java mysql connection across network

I need to connect to a mysql database across a network.
The connection string ive given is
"jdbc:mysql://host/dbname"
i can access the site across the network but the only problem is with the java database connection.
Ive updated the phpmyadmin.conf file giving
# Deny from all
Allow from all
But still the database connection cannot be made.
Please help me..
I don't know much aboud phpmyadmin, but what I did to configure a remote db:
The connection string is: jdbc:mysql://host:port/dbname
The port is 3306 by default
The mysql user is often name#localhost, you need to configure a user for the remote (client) machine (IP address, hostname, wildcard)
HTH
Ok, there are few things you need to check ...
1) If your database got username/password
2) Have you restarted your server after altering phpmyadmin.conf?
3) Make sure you are connecting to the correct port. Ex: mysql://host:port/dbname (if port differs from default.
4) make sure that the PC that have the DB allows incoming connections through the port.
If you still facing problems, try disabling your antivirus/firewall on the PC that have the DM and try.

Remote MYSQL Database Access

I have developed an application in java that access remote mysql database. While I am running it by netbeans IDE of system which have running that wamp server. But while i try I make connection in another system to remote system database by netbeans it shows following error.
Unable to add connection, Cannot establish a connection to jdbc:mysql://192.168.1.14:3306/test using(CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.
Please, kindly help me.
Thanks in Advance
From mysql forums
You could be getting this because (1) the URL of the DB is wrong, because (2) the DB isn't set up to accept connections from the web host, or because (3) some intermediate networking component is misconfigured. (1) is your problem; (2) and (3) might be your problem or the web hosting's problem, depending on where the DB is located, what administrative privileges on the DB that you have, and how the networking is set up.
You need to have the right privileges to be able to connect to MySQL remotely. There are several tools available to set it up.
Here is an article outlining several steps of which the grant step is most commonly needed.
mysql> GRANT ALL ON foo.* TO bar#'202.54.10.20' IDENTIFIED BY 'PASSWORD';
There has also been problems reported when connecting to MySQL databases in Windows Vista, but i'm not sure wether this is relevant to this case or not.
Do you have ssh access to the server? I would have run a tunnel with ssh, plink or putty (ssh -L 3305:127.0.0.1:3306 192.168.1.14) and then use this connection url
jdbc:mysql://127.0.0.1:3305/test
It would be easier to assist if we'd known your operating system.
If this is a deployment situation, opening the firewall for port 3306 from your IP address is probably the right thing. In linux you might find the settings in /etc/sysconfig/iptables, but your sysadmin may have other safe guards in place. You must also verify that mysql is actually listening on the IP-address, and not only localhost.
MySQL is standard protected so you can't access it remotely. You'll have to grant MySQL as well as the user connecting to MySQL access from outside the MySQL-machine.
Perhaps a low-level network issue.
Can you ping that IP ?
Can you telnet to that IP/port ?
e.g. telnet 192.168.1.14 3306
Establishing whether you can talk to the machine and whether you can create a basic TCP connection to the MySQL process on that machine will tell you a lot - is your network sound, is a process listening on that port etc.

Categories

Resources