14 |
import java.util.logging.Logger; |
import java.util.logging.Logger; |
15 |
|
|
16 |
|
|
17 |
|
|
18 |
public class Database { |
public class Database { |
19 |
Logger logger = Logger.getLogger(Database.class.getName()); |
Logger logger = Logger.getLogger(Database.class.getName()); |
20 |
|
|
21 |
|
int batchCount = 0; |
22 |
|
|
23 |
Connection conn; |
Connection conn; |
24 |
PreparedStatement saveStmt; |
PreparedStatement saveStmt; |
179 |
|
|
180 |
saveStmt.setDouble(19, bedsteAfstand); |
saveStmt.setDouble(19, bedsteAfstand); |
181 |
|
|
182 |
saveStmt.executeUpdate(); |
saveStmt.addBatch(); |
183 |
saveStmt.clearParameters(); |
batchCount++; |
184 |
|
if (batchCount >= 100) { |
185 |
|
saveStmt.executeBatch(); |
186 |
|
batchCount = 0; |
187 |
|
} |
188 |
|
//saveStmt.executeUpdate(); |
189 |
|
//saveStmt.clearParameters(); |
190 |
|
|
191 |
//saveStmt.close(); |
//saveStmt.close(); |
192 |
|
} |
193 |
|
|
194 |
|
public synchronized void saveBatch() throws SQLException{ |
195 |
|
saveStmt.executeBatch(); |
196 |
|
batchCount = 0; |
197 |
} |
} |
198 |
|
|
199 |
|
|
242 |
connectionProps.put("user", db_user); |
connectionProps.put("user", db_user); |
243 |
connectionProps.put("password", db_pass); |
connectionProps.put("password", db_pass); |
244 |
|
|
245 |
|
|
246 |
|
|
247 |
conn = DriverManager.getConnection( |
conn = DriverManager.getConnection( |
248 |
"jdbc:mysql://" + |
"jdbc:mysql://" + |
249 |
db_host + |
db_host + |