You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Suresh Subbiah (JIRA)" <ji...@apache.org> on 2015/08/31 07:56:46 UTC
[jira] [Closed] (TRAFODION-132) LP Bug: 1244426 - getInt() can't
handle case-sensitive delimited identifiers
[ https://issues.apache.org/jira/browse/TRAFODION-132?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Suresh Subbiah closed TRAFODION-132.
------------------------------------
Resolution: Fixed
Change status to closed in JIRA to reflect LaunchPad
> LP Bug: 1244426 - getInt() can't handle case-sensitive delimited identifiers
> ----------------------------------------------------------------------------
>
> Key: TRAFODION-132
> URL: https://issues.apache.org/jira/browse/TRAFODION-132
> Project: Apache Trafodion
> Issue Type: Bug
> Components: connectivity-dcs
> Reporter: Weishiun Tsai
> Priority: Minor
>
> In the following example, the table was created with 3 delimited identifiers with the same letters but a mixture of upper cases and lower cases: “Value”, “VALUE”, and “value”. Sqlci can handle them fine, but when using getInt() to fetch the data from a JDBC program. The following 3 statements all return value 1, which is the value of the first column:
> rs.getInt("Value");
> rs.getInt("VALUE");
> rs.getInt("value");
> Here is the correct output from sqlci:
> >>cqd mode_seabase 'on';
> --- SQL operation complete.
> >>set schema seabase.phoenix;
> --- SQL operation complete.
> >>create table t ("Value" int not null not droppable, "VALUE" int, "value" int);
> --- SQL operation complete.
> >>insert into t values (1, 2, 3);
> --- 1 row(s) inserted.
> >>select "Value" from t;
> Value
> -----------
> 1
> --- 1 row(s) selected.
> >>select "VALUE" from t;
> VALUE
> -----------
> 2
> --- 1 row(s) selected.
> >>select "value" from t;
> value
> -----------
> 3
> --- 1 row(s) selected.
> >>
> Here is the entire JDBC program including the three aforementioned statements that returned wrong values:
> -bash-4.1$ cat mytest1.java
> import java.sql.*;
> import java.math.*;
> import java.util.*;
> import java.io.*;
> public class mytest1
> {
> public static void main(String[] args) //throws java.io.IOException
> {
> Properties props = null;
> Connection conn = null;
> PreparedStatement statement = null;
> ResultSet rs = null;
> String cat = null;
> String sch = null;
> String url = null;
> try
> {
> String propFile = System.getProperty("hpt4jdbc.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: hpt4jdbc.properties is not set. Exiting.");
> System.exit(0);
> }
> Class.forName("com.hp.jdbc.HPT4Driver");
> conn = DriverManager.getConnection(url, props);
> conn.createStatement().execute("cqd mode_seabase 'on'");
> conn.createStatement().execute("set schema seabase.phoenix");
> conn.createStatement().execute("create table t (\"Value\" int not null not droppable, \"VALUE\" int, \"value\" int)");
> conn.createStatement().execute("insert into t values (1, 2, 3)");
> statement = conn.prepareStatement("select \"Value\", \"VALUE\", \"value\" from t");
> rs = statement.executeQuery();
> rs.next();
> System.out.println(rs.getInt("Value"));
> System.out.println(rs.getInt("VALUE"));
> System.out.println(rs.getInt("value"));
> conn.createStatement().execute("drop table t");
> 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);
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)