我直接在資料庫下這些指令是ok的,但是從JSP丟過去就錯了 05/09 11:26
指向 ResultSet rs = stmt.executeQuery(SQL) 有問題 05/09 11:28
但是我換成較簡單的指令都可以過 05/09 11:28
例如:select test from db2admin.test_data 05/09 11:29
真是讓我百思不得其解 =.= 05/09 11:30
: : : 推 GALINE:錯誤訊息是?單純數筆數我會用count(*) 05/09 13:27
: : : → TonyQ:那就把error message 拿出來看看. 05/09 18:31
: :
訊息指出
HTTP Status 500
type Exception report
message
description The server encountered an internal error ()
that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException:
Exception in JSP: /Pages/AA_SQL_TEST.jsp:65
62:
63:
64: String sql = "select count(*) as count from db2admin.pt_info
where year(current timestamp) - year(birthday) <35 and sex IN('F')";
65: ResultSet rs = stmt.executeQuery(sql);
66:
67:
68:
這表示65行有問題?
這個SQL指令我在資料庫指令列下是ok的
我的環境是用apache-tomcat-5.5.27
eclipse java6-u13
" db2資料庫"
2009/5/10 下午 04:09:37 org.apache.catalina.core.StandardWrapperValve invoke
嚴重的: Servlet.service() for servlet jsp threw exception
com.ibm.db2.jcc.b.SqlException: DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098,
SQLERRMC=2;-243;36001;SQL_CURSH200C1, DRIVER=3.50.152
我在這裡找到錯誤訊息解釋
http://0rz.tw/cMbyC
但是我不懂他在說啥麼
後來我亂試,重開機,由DB2的帳號登入,重灌java,Eclipse
我將Statement
stmt=conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
改成Statement
stmt=conn.createStatement();
就ok了
感謝板上各位的建議
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.162.12
※ 編輯: BILL0119 來自: 114.42.162.12 (05/12 10:51)