Skip to content

Commit 27e1ea3

Browse files
committed
DuckDB: Use a single connection
1 parent 6e62cfe commit 27e1ea3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

duckdb/src/main/java/org/ldbcouncil/snb/impls/workloads/duckdb/DuckDbConnectionState.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
public class DuckDbConnectionState<TDbQueryStore extends QueryStore> extends BaseDbConnectionState<TDbQueryStore> {
1515

16-
protected Connection connection;
16+
protected static Connection connection;
1717

1818
public DuckDbConnectionState(Map<String, String> properties, TDbQueryStore store) throws ClassNotFoundException, SQLException {
1919
super(properties, store);
20-
TimeZone.setDefault(TimeZone.getTimeZone("Etc/GMT+0"));
21-
connection = DriverManager.getConnection("jdbc:duckdb:scratch/ldbc.duckdb");
22-
Statement statement = connection.createStatement();
23-
statement.execute("PRAGMA threads=1;");
20+
if (connection == null) {
21+
// TimeZone.setDefault(TimeZone.getTimeZone("Etc/GMT+0"));
22+
connection = DriverManager.getConnection("jdbc:duckdb:scratch/ldbc.duckdb");
23+
}
2424
}
2525

2626
public Connection getConnection() throws DbException {
@@ -29,12 +29,12 @@ public Connection getConnection() throws DbException {
2929

3030
@Override
3131
public void close() {
32-
if (connection != null) {
33-
try {
34-
connection.close();
35-
} catch (SQLException e) {
36-
throw new RuntimeException(e);
37-
}
38-
}
32+
// if (connection != null) {
33+
// try {
34+
// connection.close();
35+
// } catch (SQLException e) {
36+
// throw new RuntimeException(e);
37+
// }
38+
// }
3939
}
4040
}

0 commit comments

Comments
 (0)