JDBC - Statement e PrepareStatement

Olá a todos,

Tenho dois códigos, muito semelhantes, mas apenas um funciona.
Gostaria de saber se alguem pode me dizer onde estou errando ae:

code // PreparedStatement stmt = null;
this.stmt = this.conn.prepareStatement(“show create table ?”);
this.stmt.setString(1,table);

        this.rs = this.stmt.executeQuery();
        rs.next();
        System.out.println(rs.getString(1)+" :: "+rs.getString(2));

(…)[/code]

E esse aqui funciona (mas não queria concatenar o nome da tabela direto na query):

code // Statement stmt = null;
this.stmt = this.conn.createStatement();

        this.rs = this.stmt.executeQuery("show create table "+table);
        rs.next();
        System.out.println(rs.getString(1)+" :: "+rs.getString(2));

(…)[/code]

Opa, PreparedStatament só funciona para “parâmetros” de consultas SQL, no seu caso não funciona porque você teria que ter engessado o nome da tabela!

this.stmt = this.conn.prepareStatement("show create table usuarios");

Opa, valeu!
Realmente era isso. Muito obrigado.