verification on delete statement

Hi

i need a verification on delete statement and am trying to execute this delete using prepareStatement and through parameter passing

the code is given below.plz do let me know the problem with the statement

=============================================================

public void doDelete(RunData data,Context context){

try{

connect();

data.setMessage("Connection Established");

String empName=data.getParameters().getString("row_name");

String tableName=data.getParameters().getString("table_name");

System.out.println("Table and row:>"+empName+" >"+tableName);

System.out.println("Starting to Delete>>>");

int n=delete(tableName,empName);

context.put("record_number",String.valueOf(n));

System.out.println("the Number of rows effected is:"+n);

System.out.println("Connection terminating!!!");

//close();

}catch(Exception e){

System.err.println("Exceptoin caught inside doDelete: "+e);

}

}

===========================================================

the error being displayed is:

Error on deletion :java.sql.SQLException: Syntax error or access violation, message from server: "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 ''' where Name = ''' at line 1"

PLZ DO LET ME KNOW WHAT IS WRONG HERE!!!

[1453 byte] By [Abhi_The_Software_Nerda] at [2007-11-27 11:11:24]
# 1

public int delete(String tableName,String empName){

int n=0;

System.out.println("Starting!!!delete");

try{

/*stmnt=con.createStatement();

stmnt.executeUpdate("delete from Employees where Name= 'jaggu'");*/

stmt=con.prepareStatement("delete from ? where Name = ? ");

stmt.setString(1, tableName);

stmt.setString(2, empName);

n=stmt.executeUpdate();

System.out.println("Deletion Done!!!");

}catch(Exception e){

System.out.println("Error on deletion :"+e);

}

return n;

}

Abhi_The_Software_Nerda at 2007-7-29 13:47:58 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...