Skip to content

Commit e5858cf

Browse files
committed
fixed limited to select fetch size
1 parent 205199a commit e5858cf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/com/geckotechnology/mySqlDataCompare/MySQLSchemaRetriever.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.sql.DriverManager;
55
import java.sql.ResultSet;
66
import java.sql.Statement;
7+
import java.util.Properties;
78

89
public class MySQLSchemaRetriever {
910

@@ -20,7 +21,10 @@ public MySQLSchemaRetriever(String url) {
2021
}
2122

2223
public void openConnection() throws Exception {
23-
conn = DriverManager.getConnection(url);
24+
Properties info = new Properties();
25+
info.put ("defaultFetchSize", Integer.toString(SELECT_FETCH_SIZE));
26+
info.put ("useCursorFetch", "true");
27+
conn = DriverManager.getConnection(url, info);
2428
}
2529

2630
public void closeConnection() {
@@ -36,7 +40,6 @@ public Statement createStatement() throws Exception {
3640
ResultSet.TYPE_FORWARD_ONLY,
3741
ResultSet.CONCUR_READ_ONLY,
3842
ResultSet.CLOSE_CURSORS_AT_COMMIT);
39-
stmt.setFetchSize(SELECT_FETCH_SIZE);
4043
return stmt;
4144
}
4245

0 commit comments

Comments
 (0)