Como usar o nome da tabela dinâmica na consulta SELECT usando JDBC

Eu tenho 5 ou tabela tabela para consultar de \ minha sintaxe eu gosto disso

O problema é que, quando eu executo isso, recebo um erro dizendo "..... você tem um erro na sintaxe SQL próximo? WHERE Patient_ID =?"

String sql2 = "SELECT * FROM ? WHERE Patient_ID = ?";

pst = conn.prepareStatement(sql2);

        System.out.println("SQL before values are set "+sql2);
        System.out.println("The values of table/test name recieved in TestPrint stage 1 "+tblName);
        System.out.println("The values of test name recieved in TestPrint stage 1 "+key);
        // values are outputted correctly but are not getting set in the query

        pst.setString(1, tblName);
        pst.setLong(2, key);
ResultSet rs2 = pst.executeQuery(sql2);

        while(rs2.next()){

            String ID = rs2.getString("ID");

            jLabel35.setText(ID);
            jLabel37.setText(ID);
            jLabel38.setText(ID);
       // them print command is initiated to print the panel
}

Quando eu produzo o sql usando system.out.println (sql2);

valores não são definidos no sql2

espaços reservados mysql podem substituir apenas VALUES. você não pode usar espaços reservados para nomes de tabela / campo ou outras diretivas "meta" sql. por exemplo.

questionAnswers(1)

yourAnswerToTheQuestion