Database Error : Vendor 20 - java

When I'm connecting with database it was showing following error
An error was encountered performing the requested operation:
The Network Adapter could not establish the connection
Vendor code 20
I think it was due to problem with my classpath i tried to fix it but not succeeded
my classpath is :
E:\app\JamesPJ\product\11.2.0\dbhome_1\jlib\orai18n.jar;E:\app\JamesPJ\product\11.2.0\dbhome_1\jdbc\lib\ojdc6_g.jar;E:\app\JamesPJ\product\11.2.0\dbhome_1\BIN;C:\Program Files\Java\jdk1.7.0_09\bin;C:\Users\JamesPJ\Documents;E:\app\JamesPJ\product\11.2.0\dbhome_1\jdbc\lib;E:\app\JamesPJ\product\11.2.0\dbhome_1\jlib;E:\app\JamesPJ\product\11.2.0\dbhome_1\jdbc\lib\ojdbc6.jar;E:\app\JamesPJ\product\11.2.0\dbhome_1\oc4j\jdbc\lib\orai18n.jar;E:\app\JamesPJ\product\11.2.0\dbhome_1\oc4j\jdbc\lib\ocrs12.jar
If any one know the solution please help me
Thanks in advance.....

If you are using oracle then make sure Oracle Listener is started.

The Network Adapter could not establish the connection
I think you have network related problem. So at least you have specified database connection endpoint incorrectly or database is down.

Related

Error connecting to Oracle database using JDBC [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.

Listener refused the connection with the following error: ORA-12514

I am trying to connect to an Oracle Database using java and JDBC code. I can't do that because I get the error below:
java.sql.SQLException: Listener refused the connection with the
following error: ORA-12514, TNS:listener does not currently know of
service requested in connect descriptor
What is the reason for the error and how to fix it ?
PS-
Out of all the DBMS, Oracle express 11g seems to be the most complicated and difficult to use.
Is that really the case ?
Listener does not currently know of service requested in connect
descriptor
Self explainatory. You're requesting connection to a service or instance in a DB that the DB's listener does not know, so it says "I have no clue".
Check the way you installed your Oracle 11g express. Remember that the service name there is often "xe".
I resolve this issue by increasing RAM size of my Virtual machine because i installed oracle
in VM that require more memory. So this could be one reason for your problem.

I need some help with Sakai 2.7.1 and Tomcat 5.5.33, in regards to SQL issues

Today I managed to recreate the farms with Scalr.net and apparently after a few times restarting tomcat and fixing issues, I get this error once again. The thing is I was using MySQL with a clean install on the entire server, that includes Java 6.1_24, Tomcat 5.5.33, Sakai 2.7.1. The issue I keep running into is user denied when the fact that I have this user in the MySQL Instance, as well giving it complete remote access with sakai#% and even this is not working when it was working about an hour ago since this post was made.
... Continued from above log, everything before logs just fine
2011-03-31 18:31:14,120 WARN main org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy - Could not retrieve default auto-commit and transaction isolation settings
org.apache.commons.dbcp.SQLNestedException: Error preloading the connection pool
... continued over 400+ lines...
Here is another error in regards to the access denied error...
2011-03-31 18:31:16,854 WARN main org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
java.sql.SQLException: Access denied for user 'sakai'#'ec2-50-17-184-70.compute-1.amazonaws.com' (using password: YES)
.... continued....
I now get this error whenever I startup, this is with a fresh install of tomcat/sakai
SEVERE: Unable to set localhost. This prevents creation of a GUID. Cause was: ec2-72-44-56-167.compute-1.amazonaws.com: ec2-72-44-56-167.compute-1.amazonaws.com
java.net.UnknownHostException: ec2-72-44-56-167.compute-1.amazonaws.com: ec2-72-44-56-167.compute-1.amazonaws.com
(This most recent error (Localhost) was simply fixed by restarting the amazon aws instance. Thankfully) Although I keep getting the same errors even with a fresh install... Almost as if the information is being refreshed from a cache... Or something
As with the last question you posted on this topic, the error message seems very clear: the user 'sakai'#... does not have access to login to the database you have set it up to. I recommend taking a look at the Mysql documentation to understand how to administer the user accounts to find out if you've missed a setting somewhere to allow this account to have access.
I believe I may have figured out how to fix this problem. It has nothing to do with mysql, or the apache server itself. It has to do with the failure of Scalr.net not Initializing the IP or something of that sort. After doing some research I found some issues with the HostInit issues such as....
Cannot deliver message 'HostInit' (message_id: af9dcfdb-a09e-4971-bdb7-7871b3f7e21c) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
Cannot deliver message 'BlockDeviceAttached' (message_id: a153d83f-3d96-4d53-920a-ccb80701675a) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
Cannot deliver message 'HostUp' (message_id: 1adde27c-9982-4551-b266-c3c432d1dd44) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
Cannot deliver message 'HostInit' (message_id: f1aa4b14-ef57-4361-ae56-87702d674b11) via REST to server '50.17.135.98' (server_id: e49cfec9-5bcb-44d1-bbc5-fde32450fc89). Error: 0 Timeout was reached; connect() timed out! (http://50.17.135.98:8013/control)
So what I did was I made a snapshot image of the apache server/mysql etc. and terminated them allowing the recreation of the instance and this managed to solve the problem in one manner.

IOException : The network adapter could not establish the connection

I am trying to connect to an Oracle database from my Java application. I am using oracle.jdbc.driver.OracleDriver, Version : 0/1 to connect to the database. But DriverManager.getConnection() is giving me the "The network adapter could not establish the connection". This is not happening evertime. Its happening sometimes only, may be once in 8-10 times. The stack trace am getting is :
Driver Class : oracle.jdbc.driver.OracleDriver, version 0/1
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3678)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:352)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:365)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:547)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:347)
at java.sql.DriverManager.getConnection(DriverManager.java:316)
at java.sql.DriverManager.getConnection(DriverManager.java:297)
Since I am not getting this everytime, I am not able to guess that there is any connectivity issue. I can see lots of developers have the same problem, but for them it happens everytime. Please help me, since i am literally stuck in solving this problem.
I was having a similar problem, I tried using the IP address instead of the host name in the database URL, and it worked for me.
Example jdbc:
...(DESCRIPTION=(ADDRESS.....(HOST=1.1.1.1)..)
This is probably a network issue:
Is there a firewall that's giving you trouble? Try to telnet to the port. Is the firewall stateful?
Is the DNS too slow (use IP address instead of hostname, try DNS lookup)
Do you close the connections? Are you overloading the Listener?
I would have a closer look and perhaps set a break point in
at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3678)
to see the precise IOException handled. This will tell you the underlying cause, which can help diagnose the problem.

How do I use oracle.jdbc.driver.OracleLog?

I am receiving an error from the Oracle JDBC driver (ojdbc14_g.jar) when trying to obtain a connection to a 10g database. The driver has an oracle.jdbc.driver.OracleLog class which could help but the Oracle documentation is unclear how best to use it. Has anyone had any success using this class? If so, some guidance on its use would be appreciated.
For info, the error I'm getting from the JDBC driver is:
java.sql.SQLException: No more data to read from socket
at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:208)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1
(T4CMAREngine.java:1118)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1
(T4CMAREngine.java:1070)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey
(T4CTTIoauthenticate.java:266)
at oracle.jdbc.driver.T4CConnection.logon
(T4CConnection.java:357)
at oracle.jdbc.driver.PhysicalConnection.<init>
(PhysicalConnection.java:414)
at oracle.jdbc.driver.T4CConnection.<init>
(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection
(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect
(OracleDriver.java:801)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection
(OracleDataSource.java:297)
at oracle.jdbc.pool.OracleDataSource.getConnection
(OracleDataSource.java:221)
at oracle.jdbc.pool.OracleDataSource.getConnection
(OracleDataSource.java:165)
The logging is usually too low to be interpreted by anyone except Oracle support.
Anyway, the above code indicates there is some network connectivity issue between the client and the server (more data was expected to be read from the TCP socket but it somehow got interrupted). What kind of a network are you using? You checked the status and error logs on the server listener?
Google just found this for me.
Also, try using java.sql.DriverManager.setLog(Stream|Writer) and see if that gets you any more information about what is going on.

Categories

Resources