Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
ravi magod Wrote:
-------------------------------------------------------
> Hi
[snip]
>
> prepStmt= cxn.prepareStatement(query);
>
> prepStmt.setInt(1, 1);
> rs = prepStmt.executeQuery(query); //
> Exception thrown here
Hi Ravi,
That is your problem. PreparedStatements where one wants to execute what was *prepared*, use the no-args version of execute*(), i.e. .executeQuery().
The method call you listed attempts to execute the query text with placeholders init, which is a syntax error.
-Mark
Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html
Subject
Written By
Posted
Re: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
June 04, 2012 11:29AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.