6 messages in com.mysql.lists.javaJDBC problem
FromSent OnAttachments
Mark Matthews30 Jul 1999 10:54 
Duke Martin30 Jul 1999 10:58 
Thompson, Robert (R.)30 Jul 1999 11:37 
ADIB MOTIWALA30 Jul 1999 12:15 
Duke Martin30 Jul 1999 12:31 
Christian Mack03 Aug 1999 05:27 
Subject:JDBC problem
From:Duke Martin (duke@cybersensor.com)
Date:07/30/1999 10:58:55 AM
List:com.mysql.lists.java

hi,

I have a java servlet that interacts with a MySQL database. The following is a description of my program and my problem:

I have an HTML page with buttons on it. The name/value pair submitted when a button is pushed corresponds to a name of a table on the database. Therefore, I am using a prepared statement and using the name/value from the button as a parameter in the sql select statement. The statement reads:

select column1 from ? where id='104';

The problem is that I get an sql exception syntax error. The query that the server actually receives looks like this:

select column1 from 'button_name' where id='104';

The problem is the quotes around the table name. How do I prevent this error? Is there anyway to parameterize the table name in an sql statement? Please help. Any info appreciated.

Duke