Command Not Properly Ended

I am having some problems with running some oracle statements on a java servlet. I am making a prepared statement like so

[b]stmt = m_con.prepareStatement("SELECT NAME, TORRENT_USER, TYPE FROM " +
"LIKE '%" + torrentName + "%' ? ?");[/b]

and if someone searches on different settings, you can get different searches with

[b]if(type.equals("all")) {
stmt.setString(1, "");
else {
stmt.setString(1, "AND TYPE='" + type + "'");

if(userName.trim().equals("")) {
stmt.setString(2, "");
else {
stmt.setString(2, "AND USERNAME='" + userName + "'");
When I test the search with a basic search just on name, it tells me that the command is not properly finished. I have tried searching through this, but from what I can find, most things say that it appears when there is a group by or order by. Can anyone help?


  • Found the problem, I was using my PreparedStatement wrong, lol. I fixed it with a normal statement and it is working perfectly.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion