5 messages in com.mysql.lists.javaRE: ERROR 1064
FromSent OnAttachments
a.k.a. James M. Jones30 Dec 2002 14:35 
Khalid Sheikh18 Jun 2003 16:57 
Jim Tyrrell18 Jun 2003 17:06 
Robert Mitchell18 Jun 2003 17:08 
Khalid Sheikh19 Jun 2003 14:04 
Subject:RE: ERROR 1064
From:Robert Mitchell (RMit@e-spicers.co.nz)
Date:06/18/2003 05:08:56 PM
List:com.mysql.lists.java

I'm assuming you want to substitute the '?' with an actual read-state. If so then you need to use a PreparedStatement, coding it something like this:

PreparedStatement sqlStatement = null;

sqlStatement = dbConnection.prepareStatement(mTopicEntrySelect); sqlStatement.setObject(1, "ABC"); ResultSet resultSet = sqlStatement.executeQuery();

Regards Robert

-----Original Message----- From: Khalid Sheikh [mailto:khal@silvaco.com] Sent: Thursday, 19 June 2003 11:58 a.m. To: ja@lists.mysql.com Subject: RE: ERROR 1064

Hi guys,

We are using 4.0.11a-gamma-log. The OS is Red Hat Linux release 7.3.

I am trying to call the following query from within my java code.

mTopicEntrySelect = "SELECT "+ " m.msg_class, "+ " m.msg_id, "+ " m.timestamp, "+ " m.correlation_id, "+ " m.reply_to, "+ " m.destination, "+ " m.delivery_mode, "+ " m.redelivered, "+ " m.type, "+ " m.expiration, "+ " m.priority, "+ " m.has_properties, "+ " m.small_body, "+ " m.large_body "+ "FROM dms_msg m, dms_topic_entry tse "+ "WHERE m.msg_id = tse.msg_id "+ " AND tse.read_state = ? "+ "ORDER BY m.priority DESC ";

I am getting the following error:

ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '?

Has anyone else seen something similar. What is a work around for MySQL not understanding the '?'

Thanks.