File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes is this SQL Stament correct ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "is this SQL Stament correct ???" Watch "is this SQL Stament correct ???" New topic
Author

is this SQL Stament correct ???

vikas de
Ranch Hand

Joined: Feb 07, 2001
Posts: 39
hi guys,
stmt=conn.prepareStatement("select * from klasseFaecher"+" where Klasse like'"+klasse+"'"+"where '"+kfach+"'=ja");
this statement displays a "missing operator" error...
please help....it urgent
vikas
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
to group two "where" clauses like that you really need a relation; I assume you mean "AND" in this case. You should also be careful to quote all text constants but not column names (is ja really a column name or does kfach contain the column name and 'ja' the value?), and make sure there are spaces round each keyword.
A rewritten version might therefore be:

I also strongly recommend that you get in the habit of specifying the columns to return in your SQL. It makes your software much more robust if the order of the columns in the table changes, or if new columns are added for other purposes. It also makes it much easier for reviewers and other helpers to understand


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
vikas de
Ranch Hand

Joined: Feb 07, 2001
Posts: 39
Thanx a lot...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: is this SQL Stament correct ???
 
Similar Threads
jsp:setProperty question on ENthuware com.enthuware.ets.scwcd.v5.2.450
end of ObjectInputStream
doubts on JDBC
how to delete data from a dbase
Why can subclass not have PROTECTED ACCESS?