![](/img/trans.png)
[英]Why does Spring's <jdbc:embedded-database> throw a SQLSyntaxErrorException?
[英]Why does Bluemix dashDB operation throws a SqlSyntaxErrorException with SQLCODE=-1667?
即使我不嘗試編輯表/列,也遇到此錯誤:
com.ibm.db2.jcc.am.SqlSyntaxErrorException:操作失敗,因為指定的表類型不支持該操作。 指定的表:“ DASH103985.wajihs”。 表格類型:“按欄組織”。 操作:“ WITH 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;
}
正如我在這里所解釋的,與不具有BLU加速功能的DB2相比,具有BLU加速功能的dashDB具有某些局限性。 在您的情況下,您只能對列組織的表運行具有CS隔離級別的查詢。
更改連接配置以使用CS隔離級別,或者在顯式指定ORGANIZE BY ROW
同時創建表。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.