2012-06-01 20 views
0

我通過瀏覽器發送請求http://xxxx.com/test/?app_idx=80在Java PreparedStatement中使用問號

但ibatis解析這個錯誤。

select 
    CONCAT('http://localhost:8080/apps/icon/download/?app=', app_idx) 
from test 
where app_idx = ?; 

我希望我的查詢是

select 
    CONCAT('http://localhost:8080/apps/icon/download/?app=', app_idx) 
from test 
where app_idx = **80**; 

但真正是 'HTTP://本地主機:8080 /應用/圖標/下載/應用程序= 80'。

select 
    CONCAT('http://localhost:8080/apps/icon/download/80app=', app_idx) 
from test 
where app_idx = **?**; 

有沒有辦法讓它正確?

回答

1

使用

select CONCAT('?', app_idx) 
from test 
where app_idx = ?; 

並傳遞

http://localhost:8080/apps/icon/download/?app= 

作爲第一個參數。