aspose file tools
The moose likes JDBC and Relational Databases and the fly likes cannot get resultset correctly through jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "cannot get resultset correctly through jdbc" Watch "cannot get resultset correctly through jdbc" New topic
Author

cannot get resultset correctly through jdbc

Xu Li
Greenhorn

Joined: Dec 02, 2002
Posts: 11
Hi, I have the following problem for some time now. Has anyone had such problem before and solved it? Pls. help.
The resultset returned from:
con = getConnection();
stmt = con.prepareStatement(strSql);
stmt.setString(1, userid);
stmt.setString(2, corp);
ResultSet rs = stmt.executeQuery();
while( rs.next() ){
...
}
is empty but using the same sql can get result from sqlplus. The sql is select distinct funID, disp_code, ds_name from v_sm_userpower where forbid_flag = 0 and userId = ? and pk_corp = ? and fun_property in (0, 1, 5) and group_flag <> 1 and (1=0 or fun_code like '10%' or fun_code = '20' or fun_code like '2002%' or fun_code like '2012%') order by disp_code.
the following sql also does not work: select distinct funID, disp_code, ds_name from v_sm_userpower where forbid_flag = 0 and userId = '1004AA10000000000000' and pk_corp = '1004' and fun_property in (0, 1, 5) and group_flag <> 1 and (1=0 or fun_code like '10%' or fun_code = '20' or fun_code like '2002%' or fun_code like '2012%') order by disp_code
but other userids works fine.
Xu Li
Greenhorn

Joined: Dec 02, 2002
Posts: 11
ps. The v_sm_userpower is a view using union.
Porky Liu
Greenhorn

Joined: Jan 30, 2002
Posts: 22
does not work means get error?
OK. one suggestion is to check the constraint of the column of userID
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: cannot get resultset correctly through jdbc