How to fix 'Connection aborted due to communications protocol error.' while executing query from Java to Ingres?

371 Views Asked by At

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.

0

There are 0 best solutions below