Skip to content
Snippets Groups Projects
Commit df7c8f8b authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

fixed syntax error in preparedStatement

parent 2727e2b6
No related branches found
No related tags found
No related merge requests found
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
......@@ -78,8 +78,8 @@ public class DbReader extends ProducerStage<IMonitoringRecord> {
connection = DriverManager.getConnection(this.connectionString);
PreparedStatement getIndexTable = null;
try {
getIndexTable = connection.prepareStatement("SELECT * from $1", new String[] { this.tablePrefix });
;// connection.createStatement();
getIndexTable = connection.prepareStatement("SELECT * from ?1");
getIndexTable.setString(1, this.tablePrefix);
ResultSet indexTable = null;
try { // NOCS (nested try)
indexTable = getIndexTable.executeQuery();
......@@ -159,7 +159,8 @@ public class DbReader extends ProducerStage<IMonitoringRecord> {
throws SQLException, MonitoringRecordException {
PreparedStatement selectRecord = null;
try {
selectRecord = connection.prepareStatement("SELECT * from ", new String[] { tablename });
selectRecord = connection.prepareStatement("SELECT * from ?1");
selectRecord.setString(1, tablename);
ResultSet records = null;
try {
records = selectRecord.executeQuery();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment