Commit 8be423d8 authored by Dave Cridland's avatar Dave Cridland Committed by GitHub

Merge pull request #858 from cpetzka/ExecuteSQLWithoutPreparedStatements

Using Statement instead of PreparedStatement
parents 85229183 35ed5674
......@@ -27,6 +27,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import org.jivesoftware.database.bugfix.OF33;
......@@ -367,14 +368,19 @@ public class SchemaManager {
DbConnectionManager.getDatabaseType() == DbConnectionManager.DatabaseType.db2) {
command.deleteCharAt(command.length() - 1);
}
PreparedStatement pstmt = null;
/*
* PreparedStatements are not useful at this Point, because no parameters are set. They also prevent the
* creation of trigger in orcale, so use simple statements
* (see http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraint.htm#CHDIIDBE)
*/
Statement stmt = null;
try {
String cmdString = command.toString();
if (autoreplace) {
cmdString = cmdString.replaceAll("jiveVersion", "ofVersion");
}
pstmt = con.prepareStatement(cmdString);
pstmt.execute();
stmt = con.createStatement();
stmt.execute(cmdString);
}
catch (SQLException e) {
// Lets show what failed
......@@ -382,7 +388,7 @@ public class SchemaManager {
throw e;
}
finally {
DbConnectionManager.closeStatement(pstmt);
DbConnectionManager.closeStatement(stmt);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment