aspose file tools*
The moose likes JDBC and the fly likes preparedStatement with like where clause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "preparedStatement with like where clause" Watch "preparedStatement with like where clause" New topic
Author

preparedStatement with like where clause

peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
my preparedStatement is

this query can return record if I run in Oracle sql developer, but no if in java (no record return and no error), what is the reason?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

I don't see any problem with it. Could you post (copy&paste) the command you run in SQL Developer and the records it produced?
peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
Martin Vajsar wrote:I don't see any problem with it. Could you post (copy&paste) the command you run in SQL Developer and the records it produced?


thanks for your reply, I am not in office now, but the command run successfully in SQL Developer, but not in JDBC preparestatement, in JDBC preparestatement, it returns no record.
peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
Martin Vajsar wrote:I don't see any problem with it. Could you post (copy&paste) the command you run in SQL Developer and the records it produced?




from the attachment, if the sql is run in Oracle sql developer, there is 6 records retrieved, but if use preparedstatement, no record can be retrieved, what is the problem from?


[Thumbnail for TestLike.jpg]

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

The image you posted appears to be from about three weeks ago (what look like log entries at the bottom are dated February 27). Perhaps the database has changed since then?
peter tong
Ranch Hand

Joined: Mar 15, 2008
Posts: 240
I know the problem finally, the oracle sql developer need run commit after update sql is run.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

bother those pesky transactions. always one to look out for.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: preparedStatement with like where clause