Skip to content

Commit a2e71fc

Browse files
Merge pull request #5 from rizwan-ishtiaq/master
Bugfix ; should only remove from end of query
2 parents 54cbe6e + 93d704a commit a2e71fc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/sqldump/etl/Query.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ public Boolean getDataFromSQLFile(String sqlFile, String outFile) {
5757
sb.append(System.lineSeparator());
5858
line = br.readLine();
5959
}
60-
String query = sb.toString().replace(";","");
6160
br.close();
61+
62+
// Removing semi-colon from end of query (if any)
63+
// Oracle driver will throw exception if it find ; in end
64+
String query = sb.toString().trim();
65+
if(query.endsWith(";")) {
66+
query = query.substring(0, query.length() - 1);
67+
}
68+
6269
return executeQuery(query, outFile);
6370
} catch (FileNotFoundException e) {
6471
log.error("failed to load file. error: ");

0 commit comments

Comments
 (0)