diff --git a/server/src/main/java/io/druid/db/DatabaseRuleManager.java b/server/src/main/java/io/druid/db/DatabaseRuleManager.java index 5882c964346..54045782f46 100644 --- a/server/src/main/java/io/druid/db/DatabaseRuleManager.java +++ b/server/src/main/java/io/druid/db/DatabaseRuleManager.java @@ -74,13 +74,15 @@ public class DatabaseRuleManager @Override public Void withHandle(Handle handle) throws Exception { - List> existing = handle.select( - String.format( - "SELECT id from %s where datasource='%s';", - ruleTable, - defaultTier + List> existing = handle + .createQuery( + String.format( + "SELECT id from %s where datasource=:dataSource;", + ruleTable + ) ) - ); + .bind("dataSource", defaultTier) + .list(); if (!existing.isEmpty()) { return null;