|
-
April 16th, 2010, 02:17 AM
#1
FindBugs/PreparedStatement: read query from file
Hello everyone,
I'm new to this forum and hoping to find help for the following problem: I load a SQL query from a file and execute it as PreparedStatement, like this:
Code:
query = loadQueryFromFile();
ResultSet resultSet = null;
PreparedStatement preparedStatement = null;
try {
preparedStatement = connection.prepareStatement(query); // hier meckert FindBugs
// set parameters
resultSet = preparedStatement.executeQuery();
// process result set
} finally {
// clean up resultSet and preparedStatement
}
Now FindBugs (1.3.9) is complaining "A prepared statement is generated from a nonconstant String" (SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING). Is there any possibility to read a query from a file which does *not* lead to this (or any other) FindBugs warning?
Thanks in advance,
Michael
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|