Uploaded image for project: 'Apache Trafodion (Retired)'
  1. Apache Trafodion (Retired)
  2. TRAFODION-171

LP Bug: 1274281 - JDBC T2 driver returns error 8813 accessing the ResultSet of a select count(*) statement

    XMLWordPrintableJSON

Details

    Description

      With the JDBC T2 driver, fetching the ResultSet of a select count statement returns the following error:

          • ERROR[8813] Trying to fetch from a statement that is in the closed state.

      This is seen using the beta build trafodion-ci-release-trafodion_beta-20140128-v37024_release.tar.

      Here is a small JDBC program to reproduce this problem:

      -bash-4.1$ cat mytest.java
      import java.sql.*;
      import java.math.*;
      import java.util.*;
      import java.io.*;

      public class mytest
      {
      public static void main(String[] args) //throws java.io.IOException
      {
      Properties props = null;
      Connection conn = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      String cat = null;
      String sch = null;
      String url = null;
      String query = null;

      try
      {
      String propFile = System.getProperty("hpjdbc.properties");
      if (propFile != null)

      { FileInputStream fs = new FileInputStream(new File(propFile)); props = new Properties(); props.load(fs); url = props.getProperty("url"); cat = props.getProperty("catalog"); sch = props.getProperty("schema"); }

      else

      { System.out.println("ERROR: hpjdbc.properties is not set. Exiting."); System.exit(0); }

      Class.forName("com.hp.sqlmx.SQLMXDriver");
      conn = DriverManager.getConnection(url, props);

      conn.createStatement().execute("drop table if exists tb");
      conn.createStatement().execute("create table tb (c1 int not null)");
      conn.createStatement().execute("insert into tb values (1),(2),(3),(4),(5),(6),(7),(8),(9)");

      System.out.println("select count");
      rs = conn.createStatement().executeQuery("select count from tb");
      System.out.println("rs.next()");
      if (rs.next() != false)

      { System.out.println("rs.getInt()"); System.out.println(rs.getInt(1)); }

      conn.close();
      }
      catch (SQLException se)

      { System.out.println("ERROR: SQLException"); se.printStackTrace(); System.out.println(se.getMessage()); System.exit(1); }

      catch (Exception e)

      { System.out.println("ERROR: Exception"); e.printStackTrace(); System.out.println(e.getMessage()); System.exit(1); }

      }
      }

      Here is the output of the program:

      -bash-4.1$ myrun.sh
      select count
      rs.next()
      ERROR: SQLException

          • ERROR[8813] Trying to fetch from a statement that is in the closed state.

      Attachments

        Activity

          People

            Unassigned Unassigned
            WTsai Weishiun Tsai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: