[ 
https://issues.apache.org/jira/browse/TRAFODION-171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Atanu Mishra closed TRAFODION-171.
----------------------------------
       Resolution: Fixed
         Assignee:     (was: Pavani Puppala)
    Fix Version/s: 0.8 (pre-incubation)

> LP Bug: 1274281 - JDBC T2 driver returns error 8813 accessing the ResultSet 
> of a select count(*) statement
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: TRAFODION-171
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-171
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-exe
>            Reporter: Weishiun Tsai
>            Priority: Critical
>             Fix For: 0.7 (pre-incubation), 0.8 (pre-incubation)
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to