3

即使我没有尝试编辑表/列,我也会收到此错误:

com.ibm.db2.jcc.am.SqlSyntaxErrorException: 操作失败,因为指定表的类型不支持该操作。指定表:“DASH103985.wajihs”。表类型:“按列组织”。操作:“带 RS”.. SQLCODE=-1667, SQLSTATE=42858

@MultipartConfig
public class DemoServlet extends HttpServlet {
  private static Logger logger = Logger.getLogger(DemoServlet.class.getName());
  private static final long serialVersionUID = 1L;
  @Resource(lookup="jdbc/db2")DataSource dataSource;

private String getDefaultText() {
  TweetsCombined = new String(" ");
  try {
    // Connect to the Database
    Connection con = null;
    try {
      System.out.println("Connecting to the database");
    } catch (SQLException e) {
      TweetsCombined = "first" +e;
    }

    // Try out some dynamic SQL Statements
    Statement stmt = null;

  try {
    stmt = con.createStatement();
    String tableName = "wajihs";// change table name here to one
                  // chosen in the first website
    String columnName = "msgBody";// msgBody is where the tweets
                                          // are stored
    String query = "SELECT * FROM \"" + tableName + "\"";
    ResultSet rs = stmt.executeQuery(query);

    while (rs.next()) {
      content = rs.getString(columnName) + ". ";
      if (content.toLowerCase().contains("RT".toLowerCase())
              || content.toLowerCase().contains("Repost: ".toLowerCase())) {
        // do nothing
      }
      else {
        TweetsCombined.concat(content);
      }

    }
    // Close everything off
    // Close the Statement
    stmt.close();
    // close
    con.commit();
    // Close the connection
    con.close();
  } catch (Exception e) {
    TweetsCombined = "second" +e;
    System.out.println(e.getMessage());
  }
} catch (Exception e) {
  TweetsCombined = "third" + e;
  System.out.println(e);
}
return TweetsCombined;

}

4

1 回答 1

3

正如我在此处所解释的,具有 BLU 加速功能的 dashDB 与没有 BLU 加速的 DB2 相比具有一定的局限性。在您的情况下,您只能对按列组织的表运行具有 CS 隔离级别的查询。

要么更改连接配置以使用 CS 隔离级别,要么在显式指定ORGANIZE BY ROW.

于 2015-08-19T00:28:52.890 回答