1
在我的示例應用程序中,以下代碼段工作正常。CQL SELECT失敗並顯示prepareStatement
SELECT_CQL = "SELECT * FROM " + STREAM_NAME_IN_CASSANDRA + " WHERE '" + CONTEXT_ID_COLUMN + "'=?";
Connection connection = getConnection();
statement = connection.prepareStatement(SELECT_CQL);
statement.setString(1, "123");
resultSet = statement.executeQuery();
但是,當我嘗試添加另一個參數的where子句查詢返回什麼都沒有!
SELECT_CQL = "SELECT * FROM " + STREAM_NAME_IN_CASSANDRA + " WHERE '" + CONTEXT_ID_COLUMN + "'=? AND '"+TIMESTAMP_COLUMN+"'=?";
Connection connection = getConnection();
statement = connection.prepareStatement(SELECT_CQL);
statement.setString(1, "123");
statement.setString(2, "1390996577514");
resultSet = statement.executeQuery();
當我嘗試在cqlsh終端內的確切查詢,它工作正常。
bigint,謝謝你指出這個..解決我的問題,通過使用,statement.setLong(2,1390996577514L); – udarakr