Hi,
I am getting the parse error while i try to execute a simple sql query in postgres.
java.sql.SQLExc eption: ERROR: parser: parse error at or near "and" at character 58
The Query has been changed and it is very much like the below one
select * from emp where empName like 'XXXXX' and empId=206
when I try to execute the same query in the postgresql console it is working fine but when i try to execute the same as a prepared statement from my java code it is giving the java.sql.SQLExc eption like the above.
Do Anyone have the answer for this problem????????
Expecting a Quick response.
Regards,
urmyfriend.
2 3681 michaelb 534
Recognized Expert Contributor
I suspect the problem could be with parsing of the 'XXXXX' value, maybe it's related to escaping of the single-quotes.
If you post the entire section of your code that deals with assembling and executing this query, it may help.
I suspect the problem could be with parsing of the 'XXXXX' value, maybe it's related to escaping of the single-quotes.
If you post the entire section of your code that deals with assembling and executing this query, it may help.
Hi michaelb,
Here is my code:
String getEmpId=SQLQue riesHandler.get Query("eis.toGe tEmpId");
psmt=conn.prepa reStatement(get EmpId);
psmt.setString( 1,empForm.getEm pName());
psmt.setInt(2,e mpForm.getDeptI d());
System.out.prin tln("The Query to empId with Parameters is : "+psmt.toString ());
rs=psmt.execute Query(getEmpId) ;
where the query will be like
select empId from empTab where empName like 'XXXXXXX' and deptId=13
And in the above code empForm is the Struts ActionForm object and getters are the form beans.
If i try to execute that as a statement it is executing well.
and also if i try to execute that query as a pprepare statement in the code itself it is executing well.
The only problem is when i try to get the query from the properties file eg:query.proper ties
The variable names are changed keeping the code as it is.
Thanks in Advance.
Regards,
urmyfriend
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Marc |
last post by:
I'm trying to execute a query in a postgresql database when the
following message displays:
State: S1000
Code: 7
Message: ERROR: parser: parse error at or near "."
Regs.
Marc Oost
|
by: Andrew Ayers |
last post by:
All,
I am having a problem with an INSERT onto a table I have created. First
off, here is the table:
---
CREATE TABLE reg ("customer number" SERIAL PRIMARY KEY, "company name"
VARCHAR(50) NULL, address VARCHAR(100) NULL, city VARCHAR(50) NULL,
state VARCHAR(2) NULL, zip VARCHAR(50) NULL, phone VARCHAR(50) NULL,
|
by: Uros |
last post by:
Hello!
I have problem with my function and I can find what's wrong.
WARNING: Error occurred while executing PL/pgSQL function fn_insert_entry_pending
WARNING: line 26 at SQL statement
ERROR: parser: parse error at or near "$1" at character 58
create or replace function "fn_insert_entry_pending"(varchar,varchar,varchar,varchar,varchar,boolean,boolean,date,int,int) returns integer as '
declare
|
by: nednieuws | charles |
last post by:
What does this error mean:
pg_restore: creating TABLE author
pg_restore: creating SEQUENCE author_id
pg_restore: could not execute query: ERROR: parser: parse error at or near "BY" at character 144
pg_restore: *** aborted because of error
The line in question is:
|
by: Bruno BAGUETTE |
last post by:
Hello,
I have a PL/PGSQL stored procedure that makes me mad currently... (The
stored procedure is a procedure that simulates a materialized view)
It complains about a parse error when I call that procedure :
WARNING: line 8 at execute statement
ERROR: parser: parse error at or near "organization" at character 144
So, I think that the error is in that piece of code (I've added the line
| |
by: Kevin Murphy |
last post by:
Using PG 7.4.3 on Mac OS X 10.2.8, the following "insert into ... select ..."
statement completed and then announced a syntax error, which seems bizarre.
(Don't be confused by the fact that the two tables referred to
(public.identifiers and original.identifiers) have slightly different column
names.)
egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifiers.sql
INSERT INTO public.identifiers (element_id, name, source,...
|
by: AdrianH |
last post by:
Assumptions
I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming.
FYI
Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
|
by: AdrianH |
last post by:
Assumptions
I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming.
FYI
Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
|
by: desivirus |
last post by:
hi admin.. i followed your tip in "HOW TO LIST PROCESS ID IN WINDOWS" thread..and iam trying to compile this code in cygwin ,
$gcc -mno-cygwin process.c -o -L"psapi.lib" process.exe
psapi.h and psapi.lib are in this same folder as process.c file, i am getting lonf list of errors from psapi.lib
Process.c (from http://voice.mytechnopark.com/viewtopic.php?id=51)
#include <windows.h>
#include <stdio.h>
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |