Getting parse Error at or near character "and"
От | friend 4ever |
---|---|
Тема | Getting parse Error at or near character "and" |
Дата | |
Msg-id | 622116.11649.qm@web37506.mail.mud.yahoo.com обсуждение исходный текст |
Ответы |
Re: Getting parse Error at or near character "and"
Re: Getting parse Error at or near character "and" |
Список | pgsql-hackers |
<a href="mailto:pgsql-hackers@postgresql.org">Hi,<br /><br /> I am getting the parse error while i try to execute a simplesql query in postgres.<br /><br /> java.sql.SQLException: ERROR: parser: parse error at or near "and" at character58<br /><br /> The Query has been changed and it is very much like the below one<br /><br /> select * from emp whereempName like 'XXXXX' and empId=206<br /><br /> when I try to execute the same query in the postgresql console it isworking fine but when i try to execute the same as a prepared statement from my java code it is giving the java.sql.SQLExceptionlike the above.<br /><br /> Do Anyone have the answer for this problem????????<br /><br /> Expectinga Quick response.<br /><br /> Here is my code:<br /> String getEmpId=SQLQueriesHandler.getQuery("eis.toGetEmpId");<br/> psmt=conn.prepareStatement(getEmpId);<br /> psmt.setString(1,empForm.getEmpName());<br/> psmt.setInt(2,empForm.getDeptId());<br /> System.out.println("The Query to empIdwith Parameters is : "+psmt.toString());<br /> rs=psmt.executeQuery(getEmpId);<br /><br /> where the query will be like<br/><br /> select empId from empTab where empName like 'XXXXXXX' and deptId=13<br /><br /> And in the above code empFormis the Struts ActionForm object and getters are the form beans.<br /> If i try to execute that as a statement it isexecuting well.<br /> and also if i try to execute that query as a pprepare statement in the code itself it is executingwell.<br /> The only problem is when i try to get the query from the properties file eg:query.properties<br /><br/> The variable names are changed keeping the code as it is.</a><br /><br />Plz reply back soon<br /><a href="mailto:pgsql-hackers@postgresql.org"><br/> Thanks in Advance.<br /><br /> Regards,<br /> urmyfriend </a><p><hr size="1"/>Ahhh...imagining that irresistible "new car" smell?<br /> Check out <a href="http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-">new carsat Yahoo! Autos.</a>
В списке pgsql-hackers по дате отправления: