Can't connect to Oracle database from application - oracle

after restarting operating system (aix) I am not able to connect to locally installed oracle db from my application.
connected to sqlplus and executed startup command.
Select statements working fine from sqlplus. Should we start listener separately?
But the application fails with:
Error:
IO Error: The Network Adapter could not establish the connection
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.1.v20150916-55dc7c3): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection

Related

Connection Reset Error on Weblogic

in my company i using Weblogic 10.3.6.0 on OEL 6.5 for connecting to a Oracle database in another location when i try to connect with weblogic to db i getting that error
Error encountered:
java.sql.SQLRecoverableException: IO Error: Connection reset
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:467)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at utils.dbping.main(dbping.java:204)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:167)
at oracle.net.ns.Packet.receive(Packet.java:300)
at oracle.net.ns.DataPacket.receive(DataPacket.java:106)
at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
at oracle.net.ns.NetInputStream.read(NetInputStream.java:102)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:669)
at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:578)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1166)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:322)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:94)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at utils.dbping.main(dbping.java:205)
so i change the SID to an invalid SID and get that error
Error encountered:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at utils.dbping.main(dbping.java:204)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:395)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
... 7 more
from that i found my connection to database is OK
i try that from other servers in my company and Weblogic 12c with JDK 8 and get "Connection Reset" error again
i try in my local Weblogic on Windows OS and get success
So... What can i dooo
Can you please check a few things like :
is the connection successful from console when you try to test the
datasource?
is there any firewall restricting the connection between your DB and Weblogic server.
what is the driver that you are using for your production and is it
the same as of your windows PC?
is this happening everytime or is it an intermittent issue?
check the below thread for some more hints :
Oracle 11g connection reset error

How to establish a JMS connection with EAP 7

After following all the steps for setting up a JMS client ( How to configure JMS in JBoss EAP 7?),
I have the following lines of errors:
javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.io.IOException: JBREM000202: Abrupt close on Remoting connection 3c6a9a86 to /127.0.0.1:8080 of endpoint (anonymous) <13805618>]
Caused by: java.io.IOException: JBREM000202: Abrupt close on Remoting connection 3c6a9a86 to /127.0.0.1:8080 of endpoint (anonymous) <13805618>

Setting up a database in glassfish server 4.1

As specified in oracle documentation I'm trying to setup a database in glassfish server. my JDK version is 1.8 and the glassfish is 4.1. I'm using the ojdbc7.jar.
I've put the ojdbc into \glassfish\domains\domain1\lib\ext folder and re-started both server and the database. But when I try to ping, an error comes as:
Ping Connection Pool failed for TestPool. Connection could not be allocated because: IO Error: The Network Adapter could not establish the connection
in server.log I found:
2015-04-13T18:35:25.413+0530] [glassfish 4.1] [WARNING] [test.connection.pool.failed] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=45 _ThreadName=admin-listener(2)] [timeMillis: 1428930325413] [levelValue: 900] [[
RAR8054: Exception while creating an unpooled [test] connection for pool [ TestPool ], Connection could not be allocated because: IO Error: The Network Adapter could not establish the connection]]
But I can ping "Derby Pool" which is in glassfish by default successfully. I've setup all the Connection pool properties and JVM options as mentioned in the documents.
Can someone please help to setup this correctly?
Thanks in Advance.
The driver seems to have problems connecting to the oracle instance.
Make sure you can make the connection from the glassfish to the oracle server. Especially check the hostname / port (the default oracle portnumber is 1521).
Here's a snapshot of my setup:
But while trying to ping, I found these on server log:
RAR8054: Exception while creating an unpooled [test] connection for pool [ TEST ], Connection could not be allocated because: IO Error: The Network Adapter could not establish the connection]]
Is this due to a server error, because I'm using glassfish 4.1.

How to access read-only Derby databases over a network client connection?

I'm trying to open a read-only Derby database over a network client connection (using ij / derbyclient.jar).
I have created a read-only database:
jar cMf sample.jar sample
The Derby Network Server is started.
I have tried the following connection URLs:
connect 'jdbc:derby:jar://localhost:1527/sample.jar';
connect 'jdbc:derby:jar://localhost:1527/(sample.jar)sample';
connect 'jdbc:derby://localhost:1527/jar:(sample.jar)sample';
But none of the above URLs work.
The only URL that works is:
connect 'jdbc:derby:jar:(sample.jar)sample';
It appears that read-only Derby databases can only be opened in embedded mode. Is this true ?
Solved:
After checking the "derby.log", the problem was that the read-only database needs to be able to create a temporary file.
derby.log:
java.sql.SQLException: Failed to start database 'jar:(sample.jar)sample' with class loader sun.misc.Launcher$AppClassLoader#1d450337, see the next exception for details.
...
Caused by: java.sql.SQLException: Failed to start database 'jar:(sample.jar)sample' with class loader sun.misc.Launcher$AppClassLoader#1d450337, see the next exception for details.
...
Caused by: java.sql.SQLException: Java exception: 'Unable to create temporary file: java.lang.SecurityException'.
...
Caused by: java.lang.SecurityException: Unable to create temporary file
The solution is to define a temporary directory for the database. This can be done with the "derby.storage.tempDirectory" property:
System-wide in "derby.properties":
derby.storage.tempDirectory=c:/temp
Database-wide
CallableStatement cs =
conn.prepareCall("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(?, ?)");
cs.setString(1, "derby.storage.tempDirectory");
cs.setString(2, "c:/temp");
cs.execute();
cs.close();
The network URL is:
connect 'jdbc:derby://localhost:1527/jar:(sample.jar)sample';

Getting Network error IOException in iReport during connection to MSSQL

I'm getting an error while connecting to a MSSQL server in iReport designer on Ubuntu.
JDBC driver: jtds.JDBC
Is there anything I've missed?
Exception
Message:
java.sql.SQLException: Network error IOException: Malformed reply from SOCKS server
Level:
SEVERE
Stack Trace:
Network error IOException: Malformed reply from SOCKS server
net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:410)
net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50)
net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
com.jaspersoft.ireport.designer.connection.JDBCConnection.getConnection(JDBCConnection.java:140)
com.jaspersoft.ireport.designer.connection.JDBCConnection.test(JDBCConnection.java:447)
Answering my own question, The issue with proxy connection, Without proxy it works fine

Resources