我有很大的问题无法弄清楚问题,非常感谢提前感谢帮助。
con = getConnection(SFPQueries.DATASOURCE);
stmt1 = con.prepareStatement("SELECT DISTINCT A.SUMMARIZATION_QUERY, A.AGGREGATE_ID, B.TOKEN, C.FACT_TOKEN, D.FIELD_ID, D.MEASURES "+
"FROM SUMMARIZATION_TIME_AGGRREGATE_MAPPING_TB A, SUMMARIZATION_TB B, FACT_TB C, SUMMARIZATION_MEASURES_MAPPING_TB D "+
"WHERE A.SUMMARIZATION_ID=B.SUMMARIZATION_ID AND B.FACT_ID=C.FACT_ID AND A.SUMMARIZATION_ID=D.SUMMARIZATION_ID AND A.AGGREGATE_ID=?");
stmt1.setInt(1,1);
rs1 = stmt1.executeQuery();
if(_log.isDebugEnabled()){_log.debug(" >> BEFORE " + rs1.next());}
对于上述JDBC查询,JDBC始终没有返回任何结果。
10/04/2014 11:41:56.866 INFO com.hp.sfp.core.dao.impl.BaseDAO:输入getConnection() 10/04/2014 11:41:57.253 INFO com.hp.sfp.core.dao.impl.BaseDAO:数据库信息:Url = jdbc:vertica:// * / ABCD用户名= xyz密码= XYZ @ 123 10/04/2014 11:41:57.254 INFO com.hp.sfp.core.dao.impl.BaseDAO:退出getConnection() 10/04/2014 11:41:57.382 DEBUG com.hp.sfp.core.dao.impl.SummarizationJobDAOImpl:>>错误之前
但是当我在shell上使用相同的查询时,我得到了结果!
=> SELECT DISTINCT A.SUMMARIZATION_QUERY, A.AGGREGATE_ID, B.TOKEN, C.FACT_TOKEN, D.FIELD_ID, D.MEASURES FROM SUMMARIZATION_TIME_AGGRREGATE_MAPPING_TB A, SUMMARIZATION_TB B, FACT_TB C, SUMMARIZATION_MEASURES_MAPPING_TB D WHERE A.SUMMARIZATION_ID=B.SUMMARIZATION_ID AND B.FACT_ID=C.FACT_ID AND A.SUMMARIZATION_ID=D.SUMMARIZATION_ID AND A.AGGREGATE_ID=1;
SUMMARIZATION_QUERY | AGGREGATE_ID | TOKEN | FACT_TOKEN | FIELD_ID | MEASURES
---------------------+--------------+--------------------+------------+----------+---------
select * from ... | 1 | summary_for_charge | chargefact | 37 | CALL_END_CAUSE
select * from ... | 1 | summary_for_charge | chargefact | 1 | STRUCTURE_CODE
select * from ... | 1 | summary_for_charge | chargefact | 45 | ROAMER_INDICATOR
答案 0 :(得分:0)
对不起,有人向我解释说我没有跑过去'COMMIT'。所以在数据库shell上它显示了结果,而不是通过JDBC我不能。这就是问题所在。