• Register
0 votes
390 views

Problem :

I am facing bellow error

java.sql.sqlrecoverableexception no more data to read from socket

6 5 3
6,930 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

I was able to solve this problem from application side, under the bellow scenario:

I used the database connection pooling apache tomcat-jdbc:

You can also take the following configuration parameters as a reference:

<Resource name="jdbc/exampleDB"
      auth="Container"
      type="javax.sql.DataSource"
      factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
      testWhileIdle="true"
      testOnBorrow="true"
      testOnReturn="false"
      validationQuery="SELECT 1 FROM DUAL"
      validationInterval="30000"
      timeBetweenEvictionRunsMillis="30000"
      maxActive="100"
      minIdle="10"
      maxWait="10000"
      initialSize="10"
      removeAbandonedTimeout="60"
      removeAbandoned="true"
      logAbandoned="true"
      minEvictableIdleTimeMillis="30000"
      jmxEnabled="true"
      jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
        org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
      username="your-username"
      password="your-password"
      driverClassName="oracle.jdbc.driver.OracleDriver"
      url="jdbc:oracle:thin:@localhost:1521:xe"/>

This configuration was sufficient to fix the error. This works fine for me in the scenario mentioned above.

Further Readings:

9 7 4
38,600 points
0 votes

Solution:

Reason:

This error notify an abort of a process, and the first step in resolving this error is to view in the alert log and seek for a trace file.  The "no more data to read from socket" is not a JDBC or an Oracle error. More, it is a generic communications error, mostly as the result of a TNS connectivity issue.

The "no more data to read from socket" error is most often since of an Oracle bug (in 11g) and we recommend moving to the latest release of Oracle.

For errors like this you must employ oracle support. Unfortunately you do not reference what oracle release you are exercising. The error can be concerned to optimizer bind peeking. Relying on the oracle version different workarounds apply.

You have two methods to address this:

  1. upgrade to 11.2
  2. set oracle parameter 
    _optim_peek_user_binds = false

    Naturally underscore parameters must just be set in case advised by oracle support

Another example: In case you are sending date parameters to a parameterized sql, ensure that you sent java.sql.Timestamp and not java.util.Date. Otherwise you will obtain

java.sql.SQLRecoverableException: No more data to read from socket

Example statement: In our java code, we are employing org.apache.commons.dbutils and we have the following:

final String sqlStatement = "select x from person where date_of_birth between ? and ?";
java.util.Date dtFrom = new Date(); //<-- this will fail
java.util.Date dtTo = new Date();   //<-- this will fail
Object[] params = new Object[]{ dtFrom , dtTo };
final List mapList = (List) query.query(conn, sqlStatement, new MapListHandler(),params); 

The above was impotence until we altered the date parameters to be java.sql.Timestamp

java.sql.Timestamp tFrom = new java.sql.Timestamp (dtFrom.getTime()); //<-- this is OK
java.sql.Timestamp tTo = new java.sql.Timestamp(dtTo.getTime());   //<-- this is OK
Object[] params = new Object[]{ tFrom , tTo };
final List mapList = (List) query.query(conn, sqlStatement, new MapListHandler(),params); 

Attempt two things:

  1. Place in $ORACLE_HOME/network/admin/tnsnames.ora on the oracle server server=dedicated to server=shared to approve more than one connection simultaneous. Restart oracle.

  2. In case you are employing Java this might help you: In java/jdk1.6.0_31/jre/lib/security/Java.security change securerandom.source=file:/dev/urandom to securerandom.source=file:///dev/urandom

10 6 4
31,120 points

Related questions

1 vote
1 answer 3 views
3 views
Problem: Can someone please help fix this uncaught error : java.sql.sqlexception no more data to read from socket
asked Mar 25 MUHAMMAD MUNEEB 83k points
0 votes
2 answers 723 views
723 views
Problem : I am new to the Spring and JPA, wasted 10 days and no result with the searching on internet. I want to save the object to SQL SERVER, my connection is correct but when I write .flush() I get below exception &ldquo;nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress&rdquo;
asked Jan 21, 2020 jwilliam 3.9k points
0 votes
1 answer 392 views
392 views
Problem : I am new to Spring and JPA I want to save object to SQL SERVER, connection is correct but when I write .flush() I get the exception as below javax.persistence.TransactionRequiredException: no transaction is in progress
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
1 answer 3 views
3 views
Problem: please solve it ... From the official documentation:
asked Apr 1 Ifra 24.4k points
0 votes
1 answer 957 views
957 views
Problem : I am trying to display Data from DB.But facing error as followsthe server encountered an unexpected condition that prevented it from fulfilling the request.
asked Nov 15, 2019 peterlaw 6.9k points
1 vote
1 answer 37 views
37 views
Problem : HELP! I need help understanding this error: Error creating bean with name 'employeeRepositoryDAOImple': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory. ... failed; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
asked Mar 12 Shovo210 13.8k points
0 votes
1 answer 50 views
50 views
Problem: why I cant fix this : Unable to create requested service [org.hibernate.engine.jdbc.env.spi.jdbcenvironment] .
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
1 answer 4.2K views
4.2K views
Problem : I want to configure the hibernate orm mapping tool to my java class and want to use PostgreSQL as my database also I have configured the password as "password". But when I tried to run the application, I am facing following error ... in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 2 views
2 views
Problem: Could anyone kindly assist me in resolving this uncaught error &ldquo;Cells(rows.count 1).end(xlup).row&rdquo;?
asked Apr 5 tuhin1 48.9k points
0 votes
1 answer 13 views
13 views
Problem : I am a completely novice in the hibernate world and facing this error: Generationtarget encountered exception accepting command : error executing ddl via jdbc statement .
asked Mar 13 Wafa Abu Yousef 6.1k points