0

I am trying to connect the Ingres DB through .jsp page using Java code. I am able to establish connection successfully, however when I am trying to run any query on this DB connection created, the connection is getting aborted. And I am getting the following error message - com.ingres.gcf.util.SqlEx: Connection aborted due to communications protocol error.

I have tried following few things - 1. I have tried the same code on other machine and it is working fine. But same code is not working on my machine. 2. I have tried connecting to another Ingres DB and I am still facing the same issue. 3. I have amended the query so that it will just fetch 5 rows of a single columns and still I am getting the same error.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*,java.util.*,java.io.*"%>

<%

try 
{

    int linenum = 0, linenum_1 = 0;
    String constring = "", constring1 = "";

    constring1 = "jdbc:ingres://HOST:II7/DBNAME;user=USER1;password=PWD1";
    Connection con1;
    con1 = DriverManager.getConnection(constring1);
    System.out.println("connection created");
    Statement link_table_stmt = con1.createStatement();
    System.out.println("statement created");
    ResultSet table_list_rs = link_table_stmt.executeQuery("select top 10 * from table1");
    System.out.println("Query executed!");

    table_list_rs.close();

    con1.commit();
    con1.close();

} 


catch (Exception e) {
  System.out.print(e);
    //e.printStackTrace();
}

%>

I am getting the following output - connection created statement created com.ingres.gcf.util.SqlEx: Connection aborted due to communications protocol error.

So in the last line, we were expecting to execute the query, but instead we are getting this error.

  • constring1 should be like `constring1 ="jdbc:ingres://HOST:II7/DBNAME;user=USER1;password=PWD1";` you missed to put `"` . – Swati May 29 '19 at 07:00
  • @Swati Thanks for reply. I had put double quotes(") in my code, but I missed it in the question above. I have edited the question now. And still facing same issues. – user5891930 May 29 '19 at 07:10
  • I am not sure , but as [this](https://stackoverflow.com/questions/2126607/official-reasons-for-software-caused-connection-abort-socket-write-error) says problem might of `compatible` or [this](https://forum.hibernate.org/viewtopic.php?f=1&t=951165) might be issue , also check your `error log` for more details – Swati May 29 '19 at 07:31
  • Thanks, I checked both links, but didn't got the desired solution. – user5891930 May 29 '19 at 10:34
  • edit your question with complete `error log` . – Swati May 29 '19 at 16:23
  • "first n" syntax is documented but not "top n", didn't know that was a synonym until now, so thanks. That aside, errlog.log may hold clues as others have said. The connectivity guide has a section on JDBC tracing which may also help you. Does table1 include any long data types? I have seen a bug in certain Ingres versions [ select dbmsinfo('_version'); ] where reading longs can unexpectedly abort the connection. – G Jones May 30 '19 at 07:43

0 Answers0